Lesson 18. Formulas that spill: UNIQUE, SORT, FILTER and SEQUENCE
Use the Exercises sheet of lesson18.xlsx: the students of a gym's classes, with class, day and monthly fee.
Files: lesson18.xlsx · solutions: lesson18-solutions.xlsx.
In the exercises with a sheet, type the formula in the fx bar and click Check: the sheet works it out the way Excel does, with commas between the arguments (semicolons work too), and also tries it with other data, to see whether it still works when the data changes. In the other exercises, you work in Excel with the lesson's file and type the result here.
At the end of the page you'll find the lesson's Bonus challenge: one more exercise, whose answer isn't in the book. You check it only here.
Exercise 1
Show the answer
=SORT(UNIQUE(B4:B13)) = Pilates, Spinning, Yoga, Zumba (in F4:F7): 4 classes.
Exercise 2
Show the answer
=COUNTIF(B4:B13,F4#) = 2, 2, 4, 2 (in G4:G7): Yoga, with 4 students.
Exercise 3
Show the answer
=FILTER(A4:D13,C4:C13=J2,"Nobody"): on Thursday Ryan (Yoga), Linda (Yoga) and Carlos (Spinning) come. With Saturday, the formula shows Nobody.
Exercise 4
Show the answer
=SORT(FILTER(A4:D13,C4:C13=J2,"Nobody"),4,-1): Carlos comes first and pays $50.00 (Spinning).
Exercise 5
=SEQUENCE(3). a) What appears, and in which cells? b) What does N4 show if N5 already held some text?Show the answer
a) The numbers 1, 2 and 3, in N4, N5 and N6. b) #SPILL!: N5 is in use, so the result can't spill.
Bonus challenge
The answer isn't in the book: you check it only here.
Show the answer
=SORT(FILTER(A4:A13,D4:D13>40)). FILTER takes only the first names (A4:A13) with the condition D4:D13>40, and SORT, on the outside, puts them in alphabetical order. Four students pay more than $40: Jake and Tyler ($45.00 each), Sarah and Carlos ($50.00 each). In alphabetical order, H4:H7 shows Carlos, Jake, Sarah and Tyler, so Carlos comes first. With >=40 instead of >40, the Yoga students would come in too, because they pay exactly $40.00.