Combining 2 Expressions

Happy New year,

I would like to ask for help. I am working with an expression like below: I would like to combine this 2 formula. However im getting some error.

If([DATE] >="01/01/2022,[Type]<>"Fuel ",[Amount]*0.10/1.10,โ€œ0โ€)

If([DATE] <"01/01/2022,[Type]<>"Fuel ",[Amount]*0.05/1.05, โ€œ0โ€)

Thank you for help.

1 5 121
5 REPLIES 5

Did you try using the IFS () expression?

IFS()

You need to use AND() when there are 2 criteria you need to check.
There is a quote missing after the date.
Is there a reason there is a space after Fuel? If worried about spaces then use the TRIM() function.

Try this expression:

If( AND([DATE] >="01/01/2022", TRIM([Type]) <> "Fuel"),
    [Amount]*0.10/1.10,
    [Amount]*0.05/1.05
)

Thank you it works. However if the [type] =โ€œFuel Chargeโ€ is my issue. I would like if the user select fuel charge then this row value is automatically zero

There are a couple ways. You could just wrap the IF() expression above with another IF().

I would lean towards the suggestion by @stilllifemuseum to use an IFS().

Based on what you have presented, I would create the IFS() like this:

IFS(
   AND([DATE] >= "01/01/2022", TRIM([Type]) <> "Fuel Charge"), [Amount]*0.10/1.10,
   AND([DATE] < "01/01/2022", TRIM([Type]) <> "Fuel Charge"), [Amount]*0.05/1.05,
   TRUE, 0.00
)

Your amazing thanks for help.

Top Labels in this Space