Microsoft Excel -- Formula Needed!

I have a worksheet where Column D is a list of vendor names (column named "VendorName"). In Column D, the vendorname could take up multiple rows -- so, for example, one vendor named "Seale" takes up rows D2:D9. I need to sum up the totals of the vendors, but given that my XLS is 10,000 rows I can't manually go through and add. I know I could do a Pivot Table and get the totals but vendor name, but there is another hitch. In Column U (named "LineItemAmount") there is the positive debit and in Column V (named "AdjustedAmount") there is the negative credit. I need to sum up the two of these to get the total, based on the vendor name in Column W. Please advise! Answer as soon as possible would be great.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not looking for points here... but a suggestion:
In cases like yours, where you need complex results, I've designed my sheet like a table (column headers and contiguous rows).   In a code function, I "link" to the sheet, just like linking to any other data source, and then create SQL queries that return the results and do whatever math is needed in the function code.  Of course, where the results are displayed is another issue (perhaps in a seperate sheet ??).

Hope this may help.

Scott C
Rob HensonFinance AnalystCommented:
You can use the SUMIF function.

=SUMIF($D$1:$D$10000,$D2,$U$1:$U$10000)  will add up column U for items matching D2.
=SUMIF($D$1:$D$10000,$D2,$V$1:$V$10000)  will add up column V for items matching D2.



Will give sum of both. Assumes that one is positive and one is negative.

Put in column W and copy down. This will give repeated values for each different vendor name so can enclose in an IF statement to avoid duplication:


Rob H
Rob HensonFinance AnalystCommented:
The formula with the IF will put the value for the vendor against the first entry for the vendor. If you want it against the last one try this instead:



PS Adjust the 10000 to the correct row number.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

mmcgillo88Author Commented:
I did the formula just like you said but it is not summing up to the actual value I need. There are a total of 488,687 rows in my spreadsheet. The debits are in Column V now and credits in column W. All vendors are still in column D. This formula is widely inflating the numbers, for example one vendor is B2 and B6 and just has debits amounting to 6,000 but your formula is 405,000??? NOT SURE WHY??
Rob HensonFinance AnalystCommented:
Alternatively, you could still use a Pivot Table and have a calculated field that adds the two fields together.

Rob H
mmcgillo88Author Commented:
Oh wait, this may be adding the total values for that vendor (thought it was sorted alphabetically but that doesn't seem to be the case!) Let me try to figure it out, think your solution may have worked Rob H. One second.
mmcgillo88Author Commented:
Great and quick response, thank you Rob H!
Rob HensonFinance AnalystCommented:
For the correct number of rows and amended columns V & W, the formula should be:


Might be worth rounding up the 488687 to 500000 to allow for future entries.

If this still doesn't work, can you upload some sample data?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.