Casper
Casper

Reputation: 13

Excel IF with text as option for cell as well as numbers

I'm trying to write an IF statement for Excel which is based on:

IF E93>E88 put Yes
IF E93<E88 put No

E93 can also be have the text N/A in it based on some earlier calculations

If E93 has N/A in it then I want this new IF function to put N/A as well as the output into this new cell.

If have so far:

=IF(AND(E93>E88,"Yes"),IF(E93<E88,"No"),"N/A")

But I get a VALUE# error when E93 has the text N/A which is itself put there by another IF function. The function putting N/A into E93 is:

=IF((E81>=E84),E81-E84,"N/A")

Any suggestions would be most welcome

Upvotes: 0

Views: 86

Answers (3)

Puspam
Puspam

Reputation: 2777

You can't perform relational operations on a text value "N/A", except '='. Thats why you are getting an error.
Try this formula :
=IF(E93="N/A","N/A",IF(E93>E88,"Yes","No"))

By this formula, first of all, it will be checked whether cell E93 contains "N/A" or not. If not, we can safely use relational operators on it.

Upvotes: 0

Dude_Scott
Dude_Scott

Reputation: 641

Not entirely sure if you will need to look out for this from the context of your question. But you may want to be explicit in the out put if the 2 cells are equal.

For example this would make 2 equal cells come out “No”

=IF(ISNA(E93),NA(),IF(E93>E88,”Yes”,“No”))

If a different output should be given for equal cells;

=IF(ISNA(E93),NA(),IF(E93>E88,”Yes”,IF(E93<E88,“No”,”Equal”)))

Upvotes: 0

Ron Rosenfeld
Ron Rosenfeld

Reputation: 60224

try:

=if(e93="N/A","N/A",if(e93>e88,"Yes",if(e93<e88,"No")))

Since you have not defined what should happen if e93=e88, note that this formula will return FALSE if e93 <> "N/A" and e93=e88

Upvotes: 1

Related Questions