goldenmean
goldenmean

Reputation: 18996

Query about Excel formula - Function IF(…)

I want to use the function IF() from Excel in a formula for some Cell, as shown below -

=IF(I2="SELL","(C2-F2)*D2","0")

Which means I want to see if Cell I2 has text- SELL in it (IF condition true), then I want the cell to have formula as (C2-F2)*D2, else if condition is false, it prints 0.

But trouble is that when condition is true, instead of putting the formula for the text it is putting the string (C2-F2)*D2 as it is in that Cell. What I want is that when condition is true, it should interpret (C2-F2)*D3 as formula in that cell. I tried many things , like -

=IF(I2="SELL","=((C2-F2)*D2)","0") 

or

=IF(I2="SELL","=("(C2-F2)*D2)"","0") 

but without any success.

How can I get it working?

thank you,

-AD

Upvotes: 1

Views: 397

Answers (1)

goldenmean
goldenmean

Reputation: 18996

Putting

=IF(I2="SELL",(C2-F2)*D2,0) 

does what i was looking for.

thanks,

-AD

Upvotes: 1

Related Questions