Help

Need Help Creating IF Or And Switch Statement

Solved
Jump to Solution
1693 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Juliet_S
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello, I have a table and need to assign a price depending on the status AND the Language:

    {Status} = Confirmed & {Language} = Spanish Then $95
	{Status} = Zoom & {Language} = Spanish then $85
	{Status} = cxl on time then $0
	{Status} = Late cxl & {Language} = Spanish then $95
	{Status} = Zoom & {Language} = X-Exotic then $115
	{Status} = Confirmed & {Language} = X-Exotic then $150
	{Status} = No Show & Zoom & {Language} = Spanish Then $95
	{Status} = No Show & Zoom & {Language} = Exotic Then $115

Thanks in advance!

1 Solution

Accepted Solutions
Jeremy_Oglesby
14 - Jupiter
14 - Jupiter

Hi @Juliet_S,

Since each one of those seems to have mutually exclusive conditions to the others, I think you could make each one its own conditional statement and concatenate them within the same formula field.

IF(
  AND(
    Status = 'Confirmed',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'Zoom',
    Language = 'Spanish'
  ),
  85
) &
IF(
  Status = 'cxl on time',
  0
) &
IF(
  AND(
    Status = 'Late cxl',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'Zoom',
    Language = 'X-Exotic'
  ),
  115
) &
IF(
  AND(
    Status = 'Confirmed',
    Language = 'X-Exotic'
  ),
  150
) &
IF(
  AND(
    Status = 'No Show & Zoom',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'No Show & Zoom',
    Language = 'Exotic'
  ),
  115
)

There may be clever ways to condense that by using SWITCH() functions and nested IF() functions, but I think this should work, and I think it’s probably the most straight-forward, and easily digestible presentation of your conditions.

See Solution in Thread

2 Replies 2
Jeremy_Oglesby
14 - Jupiter
14 - Jupiter

Hi @Juliet_S,

Since each one of those seems to have mutually exclusive conditions to the others, I think you could make each one its own conditional statement and concatenate them within the same formula field.

IF(
  AND(
    Status = 'Confirmed',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'Zoom',
    Language = 'Spanish'
  ),
  85
) &
IF(
  Status = 'cxl on time',
  0
) &
IF(
  AND(
    Status = 'Late cxl',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'Zoom',
    Language = 'X-Exotic'
  ),
  115
) &
IF(
  AND(
    Status = 'Confirmed',
    Language = 'X-Exotic'
  ),
  150
) &
IF(
  AND(
    Status = 'No Show & Zoom',
    Language = 'Spanish'
  ),
  95
) &
IF(
  AND(
    Status = 'No Show & Zoom',
    Language = 'Exotic'
  ),
  115
)

There may be clever ways to condense that by using SWITCH() functions and nested IF() functions, but I think this should work, and I think it’s probably the most straight-forward, and easily digestible presentation of your conditions.

Thank you! I have tested and it works well.