Google Sheets | SWITCH | IF | Function | What are the Differences | Example | Spreadsheet | Tutorial

Поделиться
HTML-код
  • Опубликовано: 14 фев 2024
  • The Google Sheets SWITCH function can assign a different value, for example, for each unique element in a range. If you want to assign the same value for a set of elements of the range, use the argument, default, of SWITCH. Another plus point of SWITCH function is it automatically applies its result to the entire range, and not just to the cell in which this function formula is entered. The IF function can also be used for the above task. However multiple IF functions within IF are required. Such a formula will be complex.
    Let's consider an example: A company has excessive stock of parts with part numbers 3RY56, 6JH29, 3TI42, 6MKW33, and 3PB68. It wants to offer a discount of 15%, 10%, and 5% to parts with part numbers 3RY56, 6JH29, and any other number respectively. The SWITCH function can be a right choice for this task, because the formula will not be complex.
    -------------------------------------
    How to Use FILTER in Google Sheets?
    Use FILTER to filter data based on one or more conditions:
    • Google Sheets Filter F...
    -------------------------------------
    How to Use SUM in Google Sheets?
    SUM enables to get the sum numbers in one or more ranges:
    • How to Sum in Google S...
    -------------------------------------
    How to Use IFS in Google Sheets?
    IFS allow multiple logical expressions:
    • Google Sheets IFS | Te...
    -------------------------------------
    How to Use IF in Google Sheets?
    Use IF to compare one value with another:
    • Google Sheets IF | Tut...
    -------------------------------------
    How to Use IF with AND in Google Sheets?
    Use IF with AND to Use Multiple Logical Expressions in IF:
    • Google Sheets | IF | A...
    -------------------------------------
    How to Create a Pivot Table in Google Sheets?
    Create a pivot table for calculation and in-depth data analysis:
    • Google Sheets | Pivot ...
    -------------------------------------
    Which one to Use? A Pivot Table, or COUNTBLANK Function, to Count Blank Cells in Google Sheets:
    Gives steps to use a pivot table or COUNTBLANK to count blank cells:
    • Google Sheets | Pivot ...
    -------------------------------------
    How to Use a Pivot Table to Sum by Rows or Columns without using Formula in Google Sheets?
    Sum numbers by rows and or columns easily, using a pivot table:
    • Google Sheets | Pivot ...
    -------------------------------------
    How to Create a Pivot Table to Get Maximum Value without Using Formula in Google Sheets?
    A pivot table assists to get the maximum value in a data range without using a formula:
    • Google Sheets | Pivot ...
    -------------------------------------
    Here is the syntax of the SWITCH function formula:
    =SWITCH(expression, case1, value1, [case2, value2, ...], [default])
    expression, for example, can be a range or a hard-coded value.
    case1 is the first condition.
    value1 is the corresponding value of case1.
    case2 and others are the second and other conditions.
    value2 and others are the corresponding value of case2 and others.
    default is the value that is applied to cases without values.
    Let's look at an example of SWITCH function formula:
    Example
    Assume there are two columns in a spreadsheet, titled Part Number and Discount. The formula below is entered in the cell immediately beneath the Discount cell:
    =SWITCH(A2:A30, "3RY56", "15%", 6JH29, "10%", "5%")
    The above formula checks whether part numbers 3RY56 and 6JH29 are among the elements of the range A2 to A30. If yes, the formula assigns a corresponding discount of 15% and 10% respectively. All other part numbers are assigned a discount of 5%.
    Take a look at this video tutorial, which highlights the differences between the Google Sheets SWITCH and IF functions, with examples.
  • ХоббиХобби

Комментарии •