Calculated column: If this than that, with a calculation
-
08-02-2021 - |
Question
I have a column named Soort. It has 3 stringvalues. One of them is Brandstof. There are 2 other columns: AantalKm and Km-vergoeding. They are both numbers fields. And there is a KostenBrandstof column. This is a calculated field (number).
The value in this field has to be: If Soort=Brandstof, then AantalKm*Km=vergoeding. Otherwise it can be 0.
So, it tried several things like this: =IF([Soort]="Brandstof";[AantalKm]*[Km-vergoeding],0)
But that does not work. What am i doing wrong?
Solution
You have a mix of semicolons and commas in your formula. Depending on your locale settings, you must stick with one of them.
Based on your column names and values I would pick commas:
=IF([Soort]="Brandstof",[AantalKm]*[Km-vergoeding],0)
If this gives the error "The formula contains a syntax error or is not supported.", swap the commas with semicolons and try again.