Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare columns and if identical then add figures 1

Status
Not open for further replies.

thomsons

Programmer
Dec 16, 2002
19
0
0
GB
I'm looking for assistance in VBA.

I'm trying to match identical entries in columns 'A - D' and if matching then add figures in column 'E' for these entries then put new information into another spreadsheet.


Worksheet (before macro ran)

ABLEXEC BZ 01010GPGAS 15169 2651389
ABLEXEC BZ 01010GPGAS 15169 2568541
ABLSHEARWA BZ 01010GPGAS 15169 -2483558.62
ABLSHEARWA BZ 01010GPGAS 15169 -1249865
ABLVFIELDS BZ 01010GPGAS 17776 -214383.12
ABLVFIELDS BZ 01010GPGAS 17776 -96543.2
AMXSATSASS BZ 01010GPGAS 17776 -323212
AMXSATSASS BZ 01010GPGAS 17776 -12123541
BPEOCBRUCE BZ 01010GPGAS 17776 -10728956.97
BPEOCBRUCE BZ 01010GPGAS 17776 -2532561
EOCANDCYRU BZ 01010GPGAS 17776 -862849
EOCANDCYRU BZ 01010GPGAS 17776 961453



Worksheet (after macro ran)


ABLEXEC BZ 01010GPGAS 15169 5219930
ABLSHEARWA BZ 01010GPGAS 15169 -3733423.62
ABLVFIELDS BZ 01010GPGAS 17776 -310926.32
AMXSATSASS BZ 01010GPGAS 17776 -12446753
BPEOCBRUCE BZ 01010GPGAS 17776 -13261517.97
EOCANDCYRU BZ 01010GPGAS 17776 98604


Any hints/tips for what I'm looking for would be greatly appriated in getting me started.

Rgds,
S.
 
Do you really need VBA? If this is to be part of a routine then that is one thing, but solely for what you have outlined, a Pivot table will do this in 60 seconds (literally) from scratch, with not an ounce of VBA in sight. The pivot Table will also give you an enormous amount of flexibility in terms of how you analyse/report your data.

That aside, given that your data seems to be ordered anyway, you could probably just put headers on it, select it all and do data / Subtotals which would allow you to collapse it a the touch of a button to the list you say you need at the end of this.

Regards
Ken...............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
S,

I totally agree with Ken except for ONE thing...

I bet I could take at least 20 seconds off his ONE MINUTE ;-)

BOTTOM LINE:

PivotTable is QUICK & POWERFUL!!!

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
39 seconds :)

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
This sounds like it could become a "European Contest" ;-)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Cheers for your feedback - I shall go for a pivot table options.

S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top