Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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 -




but without any success.

share|improve this question
Putting "" around "(C2-F2)*D2" changed it from a formula into a string. – bitslave Nov 25 '10 at 14:42
up vote 6 down vote accepted

=IF(I2="SELL",(C2-F2)*D2,0) will put the required calculated values in the cell. The formula is the complete one with the IF

As said by others = "..." just gives the string between the "" and Excel will not try to evaluate it.

share|improve this answer
Thank you, it works. – goldenmean Nov 25 '10 at 14:45
In excel quotation marks return the text between them rather than the results of the equation. This can be useful if you want to return a "Yes" from an IF statement, or as you have done use a "Sell" in the logical statement. – markfknight Jun 5 '11 at 10:34

"" will just paste a string.

Just use =IF(I2="SELL";(C2-F2)*D2;0)

share|improve this answer
May be typo , but it should not have semicolons, but commas as separators. – goldenmean Nov 25 '10 at 14:50
Sorry, that's just that I use the Spanish version of MS Office – molgar Nov 25 '10 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .