More than two options
The IF function only knows two options: yes or no. But what if you want three?
| Grade | Word |
|---|---|
| 1 | great |
| 2 | good |
| 3 and worse | practice |
You can put one IF inside another:
=IF(B2=1,"great",IF(B2=2,"good","practice"))
You read it like this:
- Is it a 1? Write great.
- If not, is it a 2? Write good.
- If it’s neither, write practice.
Try it
-
On the
Gradessheet, click on C2. -
Change the formula to
=IF(B2=1,"great",IF(B2=2,"good","practice")). -
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 💪
- The
Next stepcolumn has three options. - When you change a grade, the word changes.
- You tried IFS too.
Done when: the spreadsheet tells three options apart.
What to take away from this lesson
- IF inside IF = more options.
- IFS is easier to read.
- The spreadsheet asks in order.
- Watch your brackets.
© 2026 Ing. Martin Polak / AlgoRhino · Ketentuan penggunaan konten