Solved

Microsoft Excel -- Formula Needed!

Posted on 2012-03-30
8
482 Views
Last Modified: 2012-03-30
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.
0
Comment
Question by:mmcgillo88
  • 4
  • 3
8 Comments
 
LVL 20

Expert Comment

by:clarkscott
ID: 37787334
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
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 37787335
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.

Therefore:

=SUMIF($D$1:$D$10000,$D2,$U$1:$U$10000)+SUMIF($D$1:$D$10000,$D2,$V$1:$V$10000)

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:

=IF(D2=D1,0,SUMIF($D$1:$D$10000,$D2,$U$1:$U$10000)+SUMIF($D$1:$D$10000,$D2,$V$1:$V$10000))

Thanks
Rob H
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 37787378
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:

=IF(D2=D3,0,SUMIF($D$1:$D$10000,$D2,$U$1:$U$10000)+SUMIF($D$1:$D$10000,$D2,$V$1:$V$10000))

Thanks
Rob

PS Adjust the 10000 to the correct row number.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:mmcgillo88
ID: 37787447
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??
0
 
LVL 32

Assisted Solution

by:Rob Henson
Rob Henson earned 500 total points
ID: 37787456
Alternatively, you could still use a Pivot Table and have a calculated field that adds the two fields together.

Thanks
Rob H
0
 

Author Comment

by:mmcgillo88
ID: 37787459
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.
0
 

Author Closing Comment

by:mmcgillo88
ID: 37787479
Great and quick response, thank you Rob H!
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 37787495
For the correct number of rows and amended columns V & W, the formula should be:

=IF(D2=D3,0,SUMIF($D$1:$D$488687,$D2,$V$1:$V$488687)+SUMIF($D$1:$D$488687,$D2,$W$1:$W$488687))

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?

RH
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Formula 5 46
which one of the last argument of YEARFARCis correct to use 5 23
Why do my Excel files become huge? 27 34
Formula Help 3 22
Outlook Free & Paid Tools
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question