Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Multi IF/OR and fields ?

Solved
Jump to Solution
1203 2
cancel
Showing results for 
Search instead for 
Did you mean: 
alternaz
6 - Interface Innovator
6 - Interface Innovator

Hello community!

I am looking to display the amount of an hour of additional service to be applied to a price depending on the type of service (A, B, C or D).

This number of hours can be 0, 1 or 2.

I have already created a column that automatically displays the number of hours to be invoiced (0, 1 or 2).

I have already created a column that automatically displays the type of service (A, B, C or D).

Here are the possible scenarios :

- If my hours column displays 0h and the product type is A, B, C or D, then display 0 â‚¬
- If my hours column displays 1h or 2h, and the product type is A, then display 10 €
- If my hours column displays 1h or 2h, and the product type is B, then display 20 €
- If my hours column displays 1h or 2h, and the product type is C, then display 30 €
- If my hours column displays 1h or 2h, and the product type is D, then display 40 €

Can you help me please ?

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

 

 

IF(
  hours,
  SWITCH(
    {Product Type},
    "A", 10,
    "B", 20,
    "C", 30,
    "D", 40
  ), 0
)

 

 

Here's how that breaks down. The IF() function will execute the SWITCH() function only if the {hours} field returns a non-zero number (non-zero numbers are considered to be truthy; i.e. equivalent to True); otherwise it defaults to an output value of 0.

The SWITCH() function creates specific output based on the option chosen in the {Product Type} field.

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

 

 

IF(
  hours,
  SWITCH(
    {Product Type},
    "A", 10,
    "B", 20,
    "C", 30,
    "D", 40
  ), 0
)

 

 

Here's how that breaks down. The IF() function will execute the SWITCH() function only if the {hours} field returns a non-zero number (non-zero numbers are considered to be truthy; i.e. equivalent to True); otherwise it defaults to an output value of 0.

The SWITCH() function creates specific output based on the option chosen in the {Product Type} field.

alternaz
6 - Interface Innovator
6 - Interface Innovator

Just perfect, thank you ! @Justin_Barrett !!