TopicsCheat sheetLessons
Lurndo › Excel › IF

Learning Excel: IF

Choosing with IF

Children under 12 get the summer pass at half price. "Can the sheet tell me for each member whether they're a child?" asks Dave. That's what IF is for.

If this, then that

IF chooses between two outcomes. The first argument is a test, the second is what you get when the test is TRUE, the third what you get when it's FALSE.

F2 holds =IF(B2<12,"child","adult"). Jack is 9, the test is true, so F2 shows "child".

F2
fx

=IF(B2<12,"child","adult")

ABCDEFG
1NameAgePassVisitsPaidCategoryPer visit
2Jack9Single3£15.00child
3Nora34Annual22£240.00
4Mila15Monthly9£25.00
5Rita67Annual15£240.00
6Laura41Single£10.00
7Rory7Monthly6£25.00
8Jim72Annual18£240.00
9Will28Single4£20.00
10Hannah12Monthly11£25.00
11Sara55Annual0£240.00
12

Text, numbers and calculations

A text outcome goes in quotation marks, a number doesn't. An outcome can also be a calculation.

=IF(C2="Single",5,0) gives £5 for anyone who pays per swim and 0 for the pass holders. The test itself is just a comparison, like in the previous lesson.

Try it yourself

In F2, put "child" for anyone under 12 and "adult" for everyone else. Fill down to F11.

ABCDEFG
1NameAgePassVisitsPaidCategoryPer visit
2Jack9Single3£15.00
3Nora34Annual22£240.00
4Mila15Monthly9£25.00
5Rita67Annual15£240.00
6Laura41Single£10.00
7Rory7Monthly6£25.00
8Jim72Annual18£240.00
9Will28Single4£20.00
10Hannah12Monthly11£25.00
11Sara55Annual0£240.00
12
F2

Ready for more?

The full lesson has 5 exercises, from easy to challenging, with hints, points and a streak you can build.

Start the lesson
← PreviousComparingNext →AND, OR and NOT

SQL

  • Topics
  • All lessons
  • Cheat sheet

Excel

  • Topics
  • All lessons
  • Shortcuts

HTML & CSS

  • About the course
  • All lessons

Lurndo

  • Dashboard
  • Leaderboard
  • Premium
  • Account
  • Privacy
Nederlands