Skip to main content

Notifications

Community site session details

Community site session details

Session Id : dCvNWEXmeT3JtYMVRHnJ/Y
Power Automate - Power Automate Desktop
Answered

how to filter in excel datatable

Like (0) ShareShare
ReportReport
Posted on 13 Sep 2023 04:06:32 by 29

I would like to know how to filter only rows where the value of column 'a' in a data table is an even number.

  • chobo_power0901 Profile Picture
    29 on 14 Sep 2023 at 06:45:34
    Re: how to filter in excel datatable

    땡규

     

    이미 성공을 했어.

     

    아래의 쿼리로 실행이 되었어

    WHERE [NUM] MOD 2 = 0

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 14 Sep 2023 at 06:42:01
    Re: how to filter in excel datatable

    MOD is a MySQL function. In this case you do actually need to use the % operator. But PAD reserves % as the character for variable notation. So, you need to escape it. The correct way to escape % is to use %%. So, try this:

    SELECT [NUM]
    FROM [%str_sheetName_Num%$]
    WHERE [NUM] %% 2 = 0

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Verified answer
    chobo_power0901 Profile Picture
    29 on 14 Sep 2023 at 04:13:31
    Re: how to filter in excel datatable

    SELECT [NUM]
    FROM [%str_sheetName_Num%$]
    WHERE [NUM] MOD 2 = 0
    ;

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 14 Sep 2023 at 02:58:03
    Re: how to filter in excel datatable

    Can you please share the entire SQL statement, if you are still having a problem?

  • chobo_power0901 Profile Picture
    29 on 14 Sep 2023 at 00:07:57
    Re: how to filter in excel datatable

    WHERE [NUM]  MOD 2 = 0

  • Verified answer
    chobo_power0901 Profile Picture
    29 on 13 Sep 2023 at 23:59:30
    Re: how to filter in excel datatable

    thank you

    I'm trying to find an even value with a sql statement, but it says it's a grammar error.

    where [num] % 2 = 0

    Could you please check?

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 13 Sep 2023 at 10:19:11
    Re: how to filter in excel datatable

    The easiest way to do it would be reading the data from Excel via a SQL query. You can then set the filters in the query. See here for more reference on how to do it: https://learn.microsoft.com/en-us/power-automate/desktop-flows/how-to/sql-queries-excel

     

    Otherwise, you would need to process your table via C#/Python or similar scripts, or create a new table, loop through the Excel data and insert even numbers into the new table. Either way it is less efficient than running a SQL query to Excel.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • v-mengmli-msft Profile Picture
    on 13 Sep 2023 at 09:05:19
    Re: how to filter in excel datatable

    Hi @chobo_power0901 ,

     

    I guess I didn't notice the tag of your question.

     

    Best regards,

    Rimmon Li

  • chobo_power0901 Profile Picture
    29 on 13 Sep 2023 at 08:13:16
    Re: how to filter in excel datatable

    thank you...

     

    but, i wanna ...

    I would like to know how to use it in desktop flows.

  • v-mengmli-msft Profile Picture
    on 13 Sep 2023 at 06:03:47
    Re: how to filter in excel datatable

    Hi @chobo_power0901 ,

     

    Do you want to get the even values in a column in Excel? Please try this:

    vmengmlimsft_0-1694582663384.png

    vmengmlimsft_1-1694582722319.png

     

    If you want to filter the records with even numbers in a column, please try this:

    vmengmlimsft_2-1694584943635.png

    vmengmlimsft_3-1694584994378.png

     

     

    Best regards,

    Rimmon Li

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started