 # Formulas using the "IF" function.

• I am attempting to use the following formula but am getting a #NAME? error but I am not sure what my error is. The value cell T53 is a letter code and there are dollar values in cells E68 to E70. Any help would be appreciated.

=IF(T53=SC,V53=E68,IF(T53=CIR,V53=E69,IF(T53=so,V53=E70)))

• Re: Formulas using the &quot;IF&quot; function.

If you want to check whether the letters SC are in a cell using an if statement, then the letters have to be like this "SC", so IF(A1="SC") would be valid.

If the formula is in V53 then you would use =IF(T53="SC",E68 would mean V53 would be whatever the value in E68 is based on T53 having SC in it.

If the formula is not in V53 you can't change the value of V53 by referring to it in a formula by using V53=E68, that will not work.

Bruce :cool:

• Re: Formulas using the &quot;IF&quot; function.

You are correct that the formula is in V53 and I would like it to return a value based on the code in T53. I revised the formula to this but it still is not working for me.

IF(T53="SC"(V53,E68),IF(T53="CIR"(V53,E69),IF(T53="so"(V53,E70))))

• Re: Formulas using the &quot;IF&quot; function.

If the formula is in V53 you don't put V53 in the formula, that's where the result will be because that is where the formula is.

With the formula below we first check if T53 ="SC" then the result of the formula will be the value that is in E68, it the value is not "SC" then we check to see the the value in T53 is "CIR", if it is then the result of the formula will be the value that is in E69, if the value is not "CIR" then we will do one final check to see if the value in T53 = "so" if it is then the result of the formula is the value that is in E70, other wise the formula will return FALSE because you have the option to say what the result of the formula will be if all of those checks fail, but you don't have that so if they all fail the result in V53 will just be FALSE in all uppercase letters.

Code
``=IF(T53="SC",E68,IF(T53="CIR",E69,IF(T53="so",E70)))``

If you wanted the result to be something like "No Match" if none of the checks worked, then you could use something like this, so that you don't end up with the word FALSE as the result of the formula.

Code
``=IF(T53="SC",E68,IF(T53="CIR",E69,IF(T53="so",E70,"No Match")))``

Bruce :cool:

• Re: Formulas using the &quot;IF&quot; function.

That appears to have solved my problem, thanks.

• Re: Formulas using the &quot;IF&quot; function.

My pleasure, thanks for the feedback. :cool:

Bruce :cool:

• Re: Formulas using the &quot;IF&quot; function.

I have another question.
Can I create a formula where the result is dependent upon the color of shading in the cell? In other words if the cell is red the value will come from cell c53, if the cell is red the value would come from cell c54, etc.

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!