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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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