简体   繁体   中英

Multiple IFs in one excel formula

I have created this formula but it's giving me a #VALUE! error. Can someone help to see what is wrong? Thank you.

=IF(A2="","",IF(AND(C2="Female",OR(E2="Black")),((141*(POWER(MIN(A2/0.7,1),-0.329))*POWER(MAX(A2/0.7,1),-1.209)*POWER(0.993,F2)*1.018*1.159)),((141*(POWER(MIN(A2/0.7,1),-0.411))*POWER(MAX(A2/0.7,1),-1.209)*POWER(0.993,F2)*1.018)))),IF(AND(C2="Male",OR(E2="Black")),((141*(POWER(MIN(A2/0.9,1),-0.329))*POWER(MAX(A2/0.9,1),-1.209)*POWER(0.993,F2)*1.159)),((141*(POWER(MIN(A2/0.9,1),-0.411))*POWER(MAX(A2/0.9,1),-1.209)*POWER(0.993,F2))))

You have two IF statements in one cell, separated by a comma. Check the brackets.

The first IF has a nested IF with Female and black, which has a calculation in the TRUE part and another calculation in the FALSE part. The nested IFs are closed correctly.

Then follows a comma and and IF with Male and Black, with a calculation in the TRUE and another calculation in the FALSE part.

You need to check your syntax. You can't have two IFs in one cell like that. Excel does not work like that.

I cannot comment so please let me put it here.

To help you with your code, please check the following tips:

  1. Put ALL your formulae as text in notepad or textbox. do not use "=" yet. You may try to use the equal sign to see if your formula is working well. but you have to remove them afterwards . You can enclose them in parenthesis if it suits you.

Eg

141*(POWER(MIN(A2/0.7,1),-0.329))

into

(141*(POWER(MIN(A2/0.7,1),-0.329)))

that means it is a single item in your nested function.

  1. if you do nested if functions, finish the parenthesis first, then the commas before filling the slots with formulas you have.

Eg

= if ( , , )

or

= if ( , ,if( , , if( , , )))

Note: A single parenthesis will ruin your formula so I do this to eliminate this possibility

  1. Fill your main if function with the formula. Copy and paste as is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM