SOLVED
Home

Multiple nested IF formula in a table with calculations

gminii
Occasional Contributor

Hi!

I am a newbie in excel and am trying to create a multiple nested IF formula to calculate a price based on weight for different metals for jewelry.

 

If column 1 is Brass, multiply column 2 (grams) with column 5 (price per grams), otherwise leave cell blank

If column 1 is Silver, multiply column 2 (grams) with column 6 (price per grams), otherwise leave cell blank

If column 1 is Pale Gold, multiply column 2 (grams) with column 7 (price per grams), otherwise leave cell blank

If column 1 is Rose Gold, multiply column 2 (grams) with column 8 (price per grams), otherwise leave cell blank

If column 1 is White Gold, multiply column 2 (grams) with column 9 (price per grams), otherwise leave cell blank

 

I tried this

=IF([@Column1]="BR",[@Column2]*[@Column5],"")&IF([@Column1]="SS",[@Column2]*[@Column6],"")&IF([@Column1]="PG",[@Column2]*[@Column7],"")&IF([@Column1]="RG",[@Column2]*[@Column8],"")&IF([@Column1]="WG",[@Column2]*[@Column9],"")

 

However, the result is the correct number but it gives me 11 decimal places, even though the cell is formatted to 2 decimal places and it won't let me format the cell to a currency. "???"

 

Can anyone help me with this? 

THANK YOU!

4 Replies
Solution

Hi @gminii ,

 

I would not recommend using nested IFs, as they make formula complex. Instead, I suggest using SUMPRODUCT. If the names of the columns 5 to 9 were 'BR', 'SS', 'PG', 'RG' and 'WG' respectively, and, assuming that the name of the table is 'MyTable', your formula would be =SUMPRODUCT((MyTable[[#Headers],[BR]:[WG]]=[@Column1])*MyTable[@[BR]:[WG]]*[@Column2])

 

This should also solve your issue with formatting

 

Thanks

Yury

Thank you for your quick respone @Yury Tokarev 

I tried your solution but it results in #VALUE!

Any idea what could be the cause of this?

Hi @gminii,

 

please find attached the file with the solution. 

 

Hope it helps

Yury

Got it! Thanks for your help @Yury Tokarev You are gold!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies