Adding a Column Using the IF Function

  • Last update: July 29, 2025
  • Overview

    Application Scenario

    When you need to classify data based on certain conditions, assign corresponding values to different sorts of data, and finally create a column to store the data, using the IF function is an appropriate approach.

    1.1(有字).png

    Implementation Method

    Functions such as AND, OR, and FIND are often nested inside the IF function for use.

    Example One: Nested Use of Multiple IF Functions

    For example, you want to implement fuzzy search, classify data based on certain conditions, assign corresponding values to different sorts of data, and create a column to store the data.

    Drag a New Calculation Column operator into the Data Transformation node. Add a field and name it Category to label values containing Women as Women Products, Men as Men Products, or otherwise, as Others.

    Enter the formula IF(FIND("Women",Category description)!=0,"Women Products",IF(FIND("Men",Category description)!=0,"Men Products","Others")), as shown in the following figure.

    2-1.png

    iconNote:
    The Category field must be displayed with a blue background to be valid.

    The following table describes the formula.

    Formula
    Description

    FIND("Women's",Category_Description) != 0

    Returns 1 if the Category field contains Women, otherwise, returns 0.

    IF(FIND("Women's",Category_Description) != 0,"Women's Products",IF(FIND("Men's",Category_Description) != 0,"Men's Products","Others"))

    Labels values of the Category field containing Women as Women Products, Men as Men Products, or otherwise, as Others.

    The Data Preview page displays the new column, as shown in the following figure.

    2-2.png

    Example Two: Using the IF Function with Other Logical Functions

    Drag a New Calculation Column operator into the Data Transformation node. Add a field and name it Category to label data meeting the conditions Sales_Volume>5000 and Profit>500 as Excellent, or otherwise, as Others.

    Enter the formula IF(AND(Sales_Volume>5000,Profit>500),"Excellent","Others"), as shown in the following figure.

    FormulaDescription

    IF(AND(Sales_Volume>5000,Profit>500),"Excellent","Others")

    Returns Excellent If both conditions are met. Otherwise, returns Others.

    3-1.png

    The Data Preview page displays the new column, as shown in the following figure.

    3-2.png

    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • 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