SUM and VLOOKUP (I think!)

Orbus

New Member
Joined
Sep 7, 2012
Messages
11
Hi there, I have a sales sheet that I use VLOOKUP for to return an item value for SKU which met my needs until now. The problem that I have is that the current VLOOKUP formula that I have at present will only work out the value of one item as it only references the SKU and performs the VLOOKUP to return a value for that SKU. I also need my formula to calculate the price for multiple items which I will show below.

QTY SOLDSKUVALUE I WOULD LIKE RETURNEDVLOOKUP COLUMN: SKUVLOOKUP COLUMN: QTY SOLD = 1VLOOKUP COLUMN: QTY SOLD = EACH ADDITIONAL ITEM
1SKU-TEST110SKU-TEST1109
2SKU-TEST119
3SKU-TEST128

<tbody>
</tbody>


The formula would basically lookup a table and if the QTY SOLD was 1 it would return the value of 1 item (10) but for each additional item sold it would add on the corresponding value which for 2 items would be (10+9), 3 items (10+9+9) 4 items (10+9+9+9) etc.

Is this possible?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Would this work for you?

C2:
Code:
=IF(A2=1,VLOOKUP(B2,$E$2:$F$2,2,0),VLOOKUP(B2,$E$2:$F$2,2)+((A2-1)*VLOOKUP(B2,$E$2:$G$2,3,0)))
 
Upvote 0
Would this work for you?

C2:
Code:
=IF(A2=1,VLOOKUP(B2,$E$2:$F$2,2,0),VLOOKUP(B2,$E$2:$F$2,2)+((A2-1)*VLOOKUP(B2,$E$2:$G$2,3,0)))

Holy smokes dude, that is seriously awesome! I have been scratching my head about this for absolutely ages! Am I right in the following:

=IF(A2=1,VLOOKUP(B2,$E$2:$F$2,2,0) is how it works out the price of 1 item.
, means that if the above cell A2 is greater than 1 then perform the next calculation below
VLOOKUP(B2,$E$2:$F$2,2)+((A2-1)*VLOOKUP(B2,$E$2:$G$2,3,0))) 1st vlookup returns value 10 then 2nd vlookup deducts 1 from A2 then multiplies it by the additional item price
I cannot thank you enough for this, awesome contribution!
 
Upvote 0
Hey Orbus,

Yes, that's exactly how it works. You're welcome, glad it helped, see ya around.
 
Upvote 0
Hi guys, I tried editing the formula that Cyrus posted however it is returning incorrect values for sales with more than 1 item. The Amount Sold is in column Column D and the SKU is in Column F. The lookup table is in a separate workbook called ProductCosts and the single item price is in Column E and additional item cost is in Column F. Currently the table is 35 rows in length but I changed the lookup to search to row 100 as we are constantly adding in new SKUs and product costs. The row that I am trying to implement the formula on is row 2644

=IF(D2644=1,VLOOKUP(F2644,ProductCosts!$A$1:$G$100,5,0),VLOOKUP(F2644,ProductCosts!$A$1:$G$100,5)+((D2644-1)*VLOOKUP(F2644,ProductCosts!$A$1:$G$100,6,0)))

Dazkangel, I tried editing your formula but I got absolutely nowhere as the sections where "{2\3}" and "IF{{1\0}" have completely stumped me.

Any help is very much appreciated. Thank you very much :)
 
Last edited:
Upvote 0
Dazkangel, I tried editing your formula but I got absolutely nowhere as the sections where "{2\3}" and "IF{{1\0}" have completely stumped me.

Excel Regional Settings mean that some symbols don't travel too well.

Here's dazkangel's formula formatted in a way that hopefully works for you:

Code:
=SUMPRODUCT(VLOOKUP(B2,E$2:G2,{2;3},0)*IF({1;0},1,A2-1))

(Nice take on the problem by the way, dazkangel!) :)

Matty
 
Upvote 0
Excel Regional Settings mean that some symbols don't travel too well.

Here's dazkangel's formula formatted in a way that hopefully works for you:

Code:
=SUMPRODUCT(VLOOKUP(B2,E$2:G2,{2;3},0)*IF({1;0},1,A2-1))

(Nice take on the problem by the way, dazkangel!) :)

Matty

Hi Matty, apologies in advance for my Excel noobness but is there any way that you could explain what each part does so I can edit the formula to show the correct values on the sheet that I mentioned above that I use in real life as opposed to the example I gave in post 1 please?
 
Upvote 0
I think I have it working with the following formula as the results look correct:

Rich (BB code):
=IF(D2642=1,VLOOKUP(F2642,ProductCosts!$A$1:$G$100,5,false),VLOOKUP(F2642,ProductCosts!$A$1:$G$100,5,false)+((D2642-1)*VLOOKUP(F2642,ProductCosts!$A$1:$G$100,6,false)))

Does this look OK to everyone else?

Matty - I tried editing the formula you provided but it kept on returning the N/A error.
 
Upvote 0

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

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