0
0
Google Sheetsspreadsheet~8 mins

SWITCH function in Google Sheets - Dashboard Guide

Choose your learning style9 modes available
Dashboard Mode - SWITCH function
Goal

Find the category of a product based on its code using the SWITCH function.

Sample Data
Product CodeProduct NamePrice
A1Apple1.20
B2Banana0.80
C3Carrot0.50
D4Detergent3.00
E5Eggs2.50
F6Flour1.00
X9Unknown Item0.00
Dashboard Components
  • Category Column: Adds product category using SWITCH formula:
    =SWITCH(A2, "A1", "Fruit", "B2", "Fruit", "C3", "Vegetable", "D4", "Cleaning", "E5", "Dairy", "F6", "Baking", "Unknown")
    This formula checks the product code in A2 and returns the category name. If no match, it returns "Unknown".
  • Summary Table: Counts how many products are in each category using COUNTIF:
    =COUNTIF(E2:E8, "Fruit") (and similar for other categories)
Dashboard Layout
+----------------------+---------------------+
| Product List         | Category Summary     |
| (with SWITCH formula) | (counts per category) |
+----------------------+---------------------+
Interactivity

Filtering the product list by category updates the summary counts automatically. Selecting a category highlights matching products.

Self Check

If you add a filter to show only products in the "Fruit" category, which products remain visible and what is the count in the summary?

Key Result
Dashboard categorizes products by code using SWITCH and summarizes counts per category.