Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Excel "IF" formula??

Status
Not open for further replies.

FYRGUY

Technical User
Nov 27, 2005
42
US
I am looking for help on entering a formula in an Excel spreadsheet. I would like to enter a number in one cell and have another cell return a text. Entering a different number in the same first cell would return a different text.
Example: I enter the number "10"(no quotes) into cell A1 and cell A4 returns "On Duty", or I enter a "12" into A1 and cell A4 returns "Sick". Can Excel do this?, and if so can anyone explain to me the steps? I can do basic sum & average formulas however stumbling through the "IF" formula I can not get it to work. Any help is appreciated.

Thank you.
 
With two choices, you could use a nested IF statement:
=IF(A1="","",IF(A1=10,"On Duty", IF(A1=12,"Sick","Something else")))
This formula returns either On Duty, Sick or Something else according the value in cell A1.

If you have more choices, then consider using a VLOOKUP formula. For example, you might make a little table showing the possible input values in column J and the desired text in column K. You could then use a formula like:
=IF(A1="","",VLOOKUP(A1,$J$1:$K$10,2,FALSE))
This formula returns a blank if A1 is blank. Otherwise, it uses the lookup table in cells J1:K10 to determine the text.

Brad
 
Personally I'd probably go the VLOOKUP route as it is more scalable, and is easy to see the values that are in the list. Take a look at the FAQ on VLOOKUP and see what you think:-

How does VLOOKUP work??
faq68-4743

Regards
Ken.................

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Thanks Brad & Ken.

I went to the link you sent Ken, then printed it. I will work on these. Thank you very much for your time and explanations.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top