web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / how to test blank cell...
Power Automate
Unanswered

how to test blank cell in if condition

(0) ShareShare
ReportReport
Posted on by 75

I have a if conition as shown below

bensat2_0-1714136351137.jpeg

you can see i have used .trimmed in the second operand else my result returns as below i,e it shows not matched. But if the cell in the excel sheet is blank then i get error message sayinh that .trimmed is not a property. I use then String('Currentitem2['End User Bill"]). My ouput will be like this

bensat2_1-1714136518255.jpeg

You can see if dont use trimmed then end user shows not matched if i use String(%Currentitem2['End User Bill"],trimmed%) i get the error i mentioned earlier. My excel sheet may have values or blanks, and also when there are values unless i use .Trimmed it shows it is not matching. 

I have used a if  and solved but it means duplicating code in the True part and the false part, can we have this solved within the if Dialog box.

 

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @bensat2 

     

    Follow below approach:

     

    1. First check both cell values have not empty value

    2. Then try to compare the both cell values

    Deenuji_0-1714138027970.png

    First If condition:

    Deenuji_1-1714138112345.png

    Second If condition:

    Deenuji_2-1714138158796.png

    Code:

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Boot\\Invoicecheck.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData
    LOOP FOREACH CurrentItem IN ExcelData
     IF (IsNotEmpty(CurrentItem['Excel Value']) AND IsNotEmpty(CurrentItem['ERIF Value'])) = True THEN
     IF (CurrentItem['Excel Value'].Trimmed = CurrentItem['ERIF Value'].Trimmed) = True THEN
     Display.ShowMessageDialog.ShowMessage Title: $'''Info''' Message: $'''Matching''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
     END
     END
    END


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • bensat2 Profile Picture
    75 on at

    let me try

     

  • bensat2 Profile Picture
    75 on at

    The erif is a web portal not an excel sheet. your solution is the same as my If conditon i used. It is not simplifying in any way.

  • bensat2 Profile Picture
    75 on at

    Deenuji i iused if excel value isntempty then use %currentitem2.Trimmed% else string(%currentitem2%). I was looking at if we could some way in the same if dialog box  test for both a value or a blank.

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @bensat2 

     

    You can utilize the following if condition to assess both the value and emptiness. However, please be aware that attempting to trim the value of your current item might result in an error if the current item column is empty.

     

    Deenuji_0-1714210756676.png

     

     

    In case if you want to trim the value then you may follow the previous suggested solution where first check both column hasn't empty values then compare with trim function.

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     

  • bensat2 Profile Picture
    75 on at

    yes you are right when the trimmed is present it throws error when there is a blank in the excel

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    Hi @bensat2 


    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 180

#3
Haque Profile Picture

Haque 159

Last 30 days Overall leaderboard