← Level 4 – Sorter

7 / 12 ⏱ 22 minutes Premium

IF with more options

When yes and no aren't enough. Three or more options.

More than two options

The IF function only knows two options: yes or no. But what if you want three?

GradeWord
1great
2good
3 and worsepractice

You can put one IF inside another:

=IF(B2=1,"great",IF(B2=2,"good","practice"))

You read it like this:

  1. Is it a 1? Write great.
  2. If not, is it a 2? Write good.
  3. If it’s neither, write practice.

Try it

  1. On the Grades sheet, click on C2.

  2. Change the formula to =IF(B2=1,"great",IF(B2=2,"good","practice")).

  3. Drag it down to C6.

Simpler: IFS

Google Sheets and newer Excel have the IFS function. You write pairs of “question, result”:

=IFS(B2=1,"great",B2=2,"good",B2>=3,"practice")

It’s easier to read when you have more options.

The order matters

The spreadsheet asks the questions in order and stops at the first “yes”.

⚠️

If you wrote B2>=1 first, it would be true for every grade, and everything would say “great”. Mulai with the most exact condition.

💡

Count your brackets. However many you open, you have to close. Google Sheets colors matching pairs of brackets the same color.

Giliranmu 💪

  1. The Next step column has three options.
  2. When you change a grade, the word changes.
  3. You tried IFS too.
✅

Done when: the spreadsheet tells three options apart.

What to take away from this lesson