drjja
drjja

Reputation: 1

conditional formula checking two columns

I'm trying to applicate a formula in excel but doesn't work.

my target is this:

I have two columns A, B, and C. The values in column A can be 0,00% or any other percent The values in column B can be "Domestic" or whatever string (i.e. "Non-domestic).

the formula must check those conditions at all rows:

-column A have 0,00% and column B have "Domestic" -->, in this case, column C must be set "B is BAD"

-column A doesn't have 0,00% and column B have "Domestic" -->, in this case, column C must be set "A is BAD"

-column A doesn't have 0,00% and the column B doesn't have "Domestic" -->, in this case, column C must be set "A y B are BAD"

i have this formula but doesn't work:

=IF($A1="0%" AND $B1<>"Non-Domestic";"B is BAD",IF($A1<>"0%" AND $B1<>"Domestic";"A is BAD",IF($A1<>"0%";$B1<>"Domestic");"A y B are BAD","")))

please, could you tell me to reach it?.

thanks in advance, BR.

Upvotes: 0

Views: 33

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521178

Try entering the following formula in C1:

=IF(AND($A1=0.00%, $B1="Domestic"), "B is BAD",
    IF(AND($A1>0.00%, $B1="Domestic"), "A is BAD",
        IF($A1>0.00%, "A and B are BAD", "No error")))

The final else condition in the logic would display No Error. This would occur for the case where A1 is exactly 0.00% and B1 is not Domestic. This is the edge case which your explicit instructions did not cover.

Upvotes: 1

Related Questions