Bắt đầu ngayBắt đầu miễn phí

SWITCH it on!

Sometimes you may wish to transform your categorical variables: you can use SWITCH() for this.

The formula in cell I2 shows an example of reversing the "Kids status" variable you created to get the "Has kids?" values again from column D.

=SWITCH(H2:H25, "none", FALSE, "young", TRUE, "old", TRUE)

The first argument is a range of categorical input cells, then there are pairs of start values and transformed values.

Bài tập này là một phần của khóa học

Google Sheets nâng cao

Xem khóa học

Hướng dẫn bài tập

In cell J2, call SWITCH() to return 1 when Kids status is "none", 2 when Kids status is "young", and 3 when Kids status is "old".

Bài tập tương tác thực hành

Biến lý thuyết thành hành động với một trong các bài tập tương tác của chúng tôi

Bắt đầu bài tập