Help

Re: How to add multiple if conditions?

Solved
Jump to Solution
1318 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Manish_Patell
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a table with shipment tracking ID and Carrier,
so i want following solutions.
if Carrier = Fedex then “track1”
if Carrier = DHL then “track2”
if Carrier = Blue Dart then “track3”
if Carrier = DTDC then “track4”
if Carrier = FedexLite then “track5”

I can do it with basic if function but got stuck with multiple conditions.

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

For a situation like this, where a single field is being checked for different values, a SWITCH function may be easier to understand:

SWITCH(Carrier,
    "Fedex", "track1",
    "DHL", "track2",
    "Blue Dart", "track3",
    "DTDC", "track4",
    "FedexLite", "track5"
)

See Solution in Thread

4 Replies 4

This should work

IF(Carrier="Fedex","track1",IF(Carrier="DHL","track2",IF(Carrier="Blue Dart","track3",IF(Carrier="DTDC","track4",IF(Carrier="FedexLite","track5","")))))
Justin_Barrett
18 - Pluto
18 - Pluto

For a situation like this, where a single field is being checked for different values, a SWITCH function may be easier to understand:

SWITCH(Carrier,
    "Fedex", "track1",
    "DHL", "track2",
    "Blue Dart", "track3",
    "DTDC", "track4",
    "FedexLite", "track5"
)

@Justin_Barrett, I like that! Thanks for sharing. I didn’t even know it existed. :blush:

It’s a much cleaner formula. :grinning_face_with_big_eyes:

Manish_Patell
5 - Automation Enthusiast
5 - Automation Enthusiast

@Justin_Barrett thanks, i even didn’t know how switch() function works, thanks so much for making mw knowledgeable.