How to sum items in a column based on values in corresponding rows

bbyler

New Member
Joined
Jan 17, 2013
Messages
6
I have a purchasing spreadsheet I am working on that compares pricing for multiple items from different vendors. Column B has a the item purchase quantity, Column D has the item unit pricing from a specific vendor, and Column O determines the lowest price value from all the vendor columns and multiplies by the purchase quantity in Column B. At the bottom of column D, I need a formula that will add up the items in Column O where the vendor in Column D had the lowest price.

I have got it to work using the sumproduct formula, but it only works if the quantity is 1. Here is what I have so far:

=SUMPRODUCT(--(D3:D27=$O3:$O27),O3:O27)

That adds up all the items in column O that are the same value as column D, but again they are only the same if the quantity is 1. Somehow I need to divide the total in column O by the quantity before seeing if it is equal to the vendor unit price in column D. ie. I need the formula to add up the items in Column O, where (Column O/Column B)=Column D

Any help on this is greatly appreciated
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
It worked for me. Can you post your data?

I determined that it wouldn't work because I didn't have data through row 27 in the quantity and one of the vendor columns. If I put a one in all the vendor columns and filled out a vendor column completely with prices, it would not get the error. Is there a way to make so that this doesn't happen? Thanks
 
Upvote 0
I get #DIV/0! if there are blank cells in column B. Try this formula confirmed with Ctrl+Shift+Enter:

=SUM(IF(B3:B27,IF(D3:D27=(O3:O27/B3:B27),O3:O27)))
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top