IF formula doesn't work when I use letters in the reference cell instead of numbers

AFawcus123

New Member
Joined
Jul 31, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
=IF(B17=HBLLAV,"HAND & BODY LOTION Lavender",IF(B17=HBLSND,"HAND & BODY LOTION Sandalwood & Lavender"

I can change the contents of the reference cell B17 to a number like 1.1 and put that number into cell B17 and it works, it just won't work when I use letters. I've tried cell format as text and general. What am I missing
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Because it's text you have to add quotes.

Excel Formula:
=IF(B17="HBLLAV","HAND & BODY LOTION Lavender",IF(B17="HBLSND","HAND & BODY LOTION Sandalwood & Lavender","Undefined"))
 
Upvote 1
I know @myall_blues has provided the solution to your issue but as a suggestion, I would generally use a mapping table and Vlookup or Xlookup to do that sort of thing but if you don't want to use a mapping table consider using the new Switch function.
Excel Formula:
=SWITCH(B17,"HBLLAV","HAND & BODY LOTION Lavender","HBLSND","HAND & BODY LOTION Sandalwood & Lavender","Undefined")

 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top