Using multiple IF formulas in the same field

#1

Hello!

I am a programming coordinator at a library, managing programming for 3 different branches with multiple different rooms. I’m trying to create a formula to pull from a “room” field into another that will formulate the “address” for the building the room is in. Example: Room X, Room Y, and Z should put Address 1 in the formula column, but Room A and B are at Address 2, Room C is at Address 3. I am able to use an IF formula to get it to work for 1 room, but anytime I try and add others I get errors.

Here’s what I am working with so far:

IF(Room = “HPL Program Room”, “Address 1”, “Address 2”)

This will give me Address 1 for the “HPL Program Room” records, and address 2 for anything that is not “HPL Program Room.” If I try adding other conditions, I get errors. How do I add the other circumstances to the same string/formula field?

#2

Hi @Annie_Tillmann,

Since each condition you need to check is referencing the same field (Room), I’d suggest using a SWITCH() function for this:

It would look something like this:

SWITCH(
   {Room},
   "HPL Program Room", "Address 1",
   "Room A", "Address 2",
   "Room C", "Address 3",
   "Room B", "Address 2"
)

and you can continue adding your list of "Room", "Address" combinations inside that function. Make sure to add a comma after each address except the very last one in the list.

1 Like
#3

Hi @Annie_Tillmann - you can use a nested IF formula, although a SWITCH formula might work better in this case:

SWITCH(Room,
 'Room 1', 'Address 1',
'Room 2', Address 2'
)

JB

1 Like
#4

Thank you, this worked wonders!