Use switch to count cost

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hi all,

I just need a little help using a switch formula, I've used it before, but now I can't seem to make it work.

I'm using a nested if...
Code:
=IF(C5='Item Pricing'!C3,'Item Pricing'!G3,IF(C5='Item Pricing'!C4,'Item Pricing'!G4,IF(C5='Item Pricing'!C5,'Item Pricing'!G5,"-")))*B5

Which works, but I have another ten rows to add, and I know that switch is easier to use. Any help would be greatly appreciated!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
To the best of my knowledge, there is no "switch" function in excel formulas (if that is what you meant?).
Perhaps you mean something like this?

=sumif('Item Pricing'!$C$3:$C$100,$C$5,'Item Pricing'!$G$3:$G$5)*B5
 
Upvote 0
That only returned a True/False result. The SWITCH formula is 2016 and newer for excel. I had a formula that did this on another file, but I lost it, and can't remember what I did to make the formula work.
 
Upvote 0
That only returned a True/False result.

Then perhaps you entered it wrong, SUMIF will only return a value (sum of values or 0) or an error, not T/F

What do you get with just the SUMIF?
=sumif('Item Pricing'!$C$3:$C$100,$C$5,'Item Pricing'!$G$3:$G$5)
 
Upvote 0
If you insist on an IF-like function...

=$B5*INDEX('Item Pricing'!$G$3:$G$25,MATCH($C5,'Item Pricing'!$C$3:$C$25,0))
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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