Two formulas in one cell?

  • Thread starter Thread starter The Stoat
  • Start date Start date
T

The Stoat

Hi all,

Is it possible to have two formulas in one cell? For example, here's what
I'm trying to do:

If cell A1 has the word HORSE in it, I want the formula in A2 to be x + z
If cell A1 has the word PIG in it, I want the formula in A2 to be x * z

Anyone know if that's possible?

Many thanks,

Matt.
 
If the lower upper case does not matter

=IF(A1="horse",x+z,IF(A1="pig",x*z,""))

if it matters

=IF(--EXACT(A1,"HORSE")=1,x+z,IF(--EXACT(A1,"PIG")=1,x*z,""))

or

=IF(ISNUMBER(FIND("HORSE",A1)),x+z,IF(ISNUMBER(FIND("HORSE",A1)),x*z,""))
 
Just some clarification please.
=IF(--EXACT(A1,"HORSE")=1,x+z,IF(--EXACT(A1,"PIG")=1,x*z,""))
if exact returns true or false and IF is looking for true or false, what is
the point of coercing to a number, then comparing to a number to get a true
or false result? Or did you just get carried away?
 
Great, thanks - I'll give that a go!

Matt.

Peo Sjoblom said:
If the lower upper case does not matter

=IF(A1="horse",x+z,IF(A1="pig",x*z,""))

if it matters

=IF(--EXACT(A1,"HORSE")=1,x+z,IF(--EXACT(A1,"PIG")=1,x*z,""))

or

=IF(ISNUMBER(FIND("HORSE",A1)),x+z,IF(ISNUMBER(FIND("HORSE",A1)),x*z,""))

--

Regards,

Peo Sjoblom
 
Back
Top