IF statement

  • Thread starter Thread starter James Beam
  • Start date Start date
J

James Beam

Need help with an IF statement.

If cell B25 has either 25 or -25, I need cell d7 to return the value of 3



Thank You
 
James,

Although the solutions of both John and Ragdyer *are* correct, they are
based on the fact that you specified two values (25) which differ only in
sign.

A more "basic" formula for cell D7 - indifferent for which two values you
use - would be :

=IF(OR(B25=25,B25=-25),3,Value or Formula applying when B25 isn't 25 or -25)



--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *
 
Ragdyer said:
Try this in D7:

=3*(MOD(B25,25)=0)

This returns 3 if B25 is empty or 0 or 50 or -75 etc.

I'd recommend sticking with John's reply
=IF(ABS(B25)=25,3,"")
 
You're right !
I guess I should have done a little (lot) more testing.

Let's combine the two thoughts:
=3*(ABS(B25)=25)
 
Let us generalize this.
Column A contains the list of values we are checking for.
In our case 25 and -25
Column C contans the data that need to be check.
Then in D1 put
=NOT(ISNA(MATCH(C1,$A$1:OFFSET($A$1,COUNT(A:A)-1,0),0)))


This allows to change the "match set" in column A,
and it will work even if you change the number of items int this list.

Based on the true/false value in column D you can then create the values
you need.
 
Back
Top