Help

Re: If this or this then this otherwise that unless blank then stay blank

Solved
Jump to Solution
913 1
cancel
Showing results for 
Search instead for 
Did you mean: 
AndreaR
6 - Interface Innovator
6 - Interface Innovator

Hi there, I am trying to create an If/or formula and got it to work but I can't get the formula to be blank if there's no data in a field. I'm sure that makes no sense. 

Here's an example: Let's say I have a small list of produce in a column. I want to create a formula in a new column to give me the category of produce either as a fruit or as a vegetable. I got the formula to work but if no produce has been selected I'm still seeing "Vegetable" in the formula column and I want it to return a blank value. Any ideas? Here's the example formula. Thanks in advance!

IF(OR({Produce}="Grape",{Produce}="Apple"),"Fruit","Vegetable")

 

1 Solution

Accepted Solutions
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hah no that makes perfect sense.  Try this:

IF(
  Produce,
  IF(
    OR(
      Produce = "Apple",
      Produce = "Grape"
    ),
    "Fruit",
    "Vegetable"
  )
)

Screenshot 2024-02-18 at 12.42.27 PM.png

See Solution in Thread

3 Replies 3
TheTimeSavingCo
18 - Pluto
18 - Pluto

Hah no that makes perfect sense.  Try this:

IF(
  Produce,
  IF(
    OR(
      Produce = "Apple",
      Produce = "Grape"
    ),
    "Fruit",
    "Vegetable"
  )
)

Screenshot 2024-02-18 at 12.42.27 PM.png

Hi,
Sometimes, if you list is large, especially when it is somewhere in the table form, you might want to use switch. The last (optional) value is default - when data exists, but such item is absent in list

SWITCH(Produce,
'','',
'Apple','Fruit',
'Grape','Fruit',
'Celery','Vegetasble',
'something unknown')

YES!  This is awesome, thank you and have a good one.🏆👨‍🍳