Multiple IF statements with Variables

thelsleyjr

New Member
Joined
Sep 18, 2019
Messages
3
Trying to do the following.

If B12 = "#3 Ham & Cheese" and C12 = "Regular", then J12 = 6.65
If B12 = "#3 Ham & Cheese" and C12 = "Mini", then J12 = 5.55
If B12 = "#7 Turkey & Cheese" and C12 = "Regular", then J12 = 7.65
If B12 = "#7 Turkey & Cheese" and C12 = "Mini", then J12 = 5.75

There are additional arguments but this should get me started.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Instead of using a bunch of IF statements you might be better off making a list and then using an INDEX function like in the example below.
I also showed a way to use nested IFs.
Excel Workbook
ABCDEFGHIJ
5List
6#3 Ham & CheeseRegular6.65
7#3 Ham & CheeseMini5.55
8#7 Turkey & CheeseRegular7.65
9#7 Turkey & CheeseMini5.75
10
11
12#7 Turkey & CheeseRegular7.65
13
147.65
Sheet
 
Upvote 0
My only concern with that is how user friendly it appears. It will be accessible to a lot of people and I want them to be able to select a sandwich and size and know the total. Id have to mess with that more, as I'm less familiar. The old way was, all of the variety sandwiches were priced the same, so the only difference was size. This was the formula. =IF(C12="Regular","7.00",IF(C12="Mini","5.00",0))+IF(I12="",0,LOOKUP(I12,{"Lays","BBQ","Doritos"},{1,1,1}))
 
Upvote 0
Another way with a list would be to use SUMPRODUCT.
You could put the list on another Worksheet. The advantage of a list is it would be easy to update pricing. You could make B12 and C12 drop down lists to choose from.
Excel Workbook
ABCDEFG
5List
6#3 Ham & CheeseRegular6.65
7#3 Ham & CheeseMini5.55
8#7 Turkey & CheeseRegular7.65
9#7 Turkey & CheeseMini5.75
10
11
12#3 Ham & CheeseRegular6.65
Sheet
 
Upvote 0
Another option using a lookup table


Book1
ABCDEFG
1List
2#3 Ham & CheeseRegular6.65
3#3 Ham & CheeseMini5.55
4#7 Turkey & CheeseRegular7.65
5#7 Turkey & CheeseMini5.75
6
7
8#3 Ham & Cheesemini5.55
RC
Cell Formulas
RangeFormula
F8=INDEX(G2:G5,MATCH(B8&"|"&C8,INDEX(E2:E5&"|"&F2:F5,0),0))
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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