Login / Register ID | EN
This page has no official English version. It was translated automatically and may contain errors. Read the original in Indonesian →
Rumus IF di Google Sheets: Urutan Kondisi, Pemisah Argumen, dan Batasnya
Foto: Pexels
Office IT

IF Formula in Google Sheets: Condition Order, Argument Separator, and Its Limits

The IF function is the first formula that almost everyone learns in spreadsheets, and it is also the formula that is most often silently misunderstood. It rarely triggers an error message. What usually happens is more subtle: the numbers appear, seem reasonable, but some of them are incorrect and are only discovered weeks later.

Here are some things that are written in the official documentation and are most often overlooked.

The third argument can be empty, and that’s a source of problems

Google states the syntax as IF(logical_expression; value_if_true; value_if_false). The third argument is marked as optional, and if left empty, the result is blank by default.

The consequences are significant: a formula that misses the last argument does not return an error, but rather a blank cell. In a long column, a blank cell can easily be mistaken for a row that has not been filled in, when in fact it is the formula's answer.

Google also includes a brief note on the same page that entering value_if_true and value_if_false in the correct order is one of the most common sources of problems with this function.

Argument separators follow Locale, not preference

An example of a formula you copied from the internet often uses commas, while in your sheet, semicolons are applicable, or vice versa. This is not a bug. Argument separators follow the spreadsheet's Locale settings.

You can find it under File, then Settings, then the General section, in the Locale and Time zone menu. One thing to remember before changing it: this change applies to the entire spreadsheet and is visible to everyone working on it, regardless of their location. So changing the Locale just to make one formula work is not a local action.

A small note that is often asked: function names can indeed be displayed in languages other than English, but the official list of supported languages contains 22 languages, and Indonesian is not included. In Indonesian sheets, the name remains IF.

IF stops at the first true condition

This is the most costly mistake. When multiple IFs are nested, evaluation stops at the first condition that is true, and does not continue to the next conditions.

Microsoft's documentation provides a clear example through tiered commissions. If the thresholds are arranged from smallest to largest, a sale of 12,500 will pass the test of being greater than 5,000 first, returning 10 percent, and then stop there. The 17.5 percent rate that should apply is never reached, and the formula does not produce any error at all.

The practical rule is: arrange thresholds from the strictest to the loosest. For values or targets, start from the highest number.

When to stop nesting

Excel allows up to 64 nested IFs, and Microsoft's own documentation states that this is highly discouraged. The reason they provide is not about performance but maintenance: a formula that is not accurately structured can be correct 75 percent of the time and incorrect 25 percent, while your chances of catching that 25 percent are slim.

Two alternatives available in Google Sheets:

  • IFS(condition1; value1; condition2; value2; ...) evaluates multiple conditions and returns the value of the first true condition. One thing to remember: if all conditions are FALSE, the result is #N/A. Not blank, not zero.
  • SWITCH(expression; case1; value1; ...; [default]) tests one expression against a list of cases. The last optional argument is the default value, used if no cases match. If your need is to match one value to many possibilities, this form is shorter and the default is already available without any tricks.

For tiered cases, Microsoft recommends using a reference table with VLOOKUP instead of nested formulas, for a reasonable reason: the table is visible, can be updated without touching the formula, and can be stored in another sheet.

Before blaming the formula

Three things worth checking first when the IF result seems odd: whether the third argument is truly present, whether the order of thresholds is from strict to loose, and whether the argument separator matches the sheet's Locale. All three share the same characteristic, which is failing without an error message, and that is why they should be checked first before dismantling the formula.

If you prefer to see the explanation directly rather than reading it, there is a short clip discussing the basics of the IF function in Google Sheets.

Sources

  1. IF Function, Google Docs Editors Help
  2. IFS Function, Google Docs Editors Help
  3. SWITCH Function, Google Docs Editors Help
  4. Setting location and calculation settings in spreadsheets, Google Docs Editors Help
  5. IF function, nested formulas and avoiding pitfalls, Microsoft Support