Adding a Column Using the SWITCH Function

  • Last update: December 31, 2025
  • Overview

    Adding a Column Using the IF Function describes how to assign values based on specified conditions to form a new data column.

    If you only want to perform group assignment on existing data without setting judgment conditions, you can use the built-in formula SWITCH.

    Procedure

    This example describes how to assign values to a new column based on the Shipper field, where if the shipper is 1, set the value to Shipper1; if 2, Shipper2; if 3, Shipper3; otherwise, set it to Unknown.

    In Data Transformation, after extracting the specified data table, add a New Calculation Column operator, as shown in the following figure.

    Click Add Field, set the field name, and click Add Field Value to enter the setting page, as shown in the following figure. 

     

    Enter the formula SWITCH(Shipper,1, "Shipper1", 2, "Shipper2", 3,"Shipper3","Unknown"), as shown in the following figure.

    iconNote:
    The Shipper field needs to be selected from the left column and cannot be entered manually.

    Click Data Preview to view the new column, as shown in the following figure.


    附件列表


    主题: Data Development - Scheduled Task
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy