cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nap123
New Member

Comparing date from Excel row and today's date

Hello!

 

I want to compare date from an Excel row and whatewer I try I always get the same error. 

nap123_0-1642403095230.png

For an easier understanding this is my flow and my excel rows. Basically Every hour I firstly convert the time line, then I list the rows in the Excel and then there is the if statement where I check if there are any dates matching. If they match I then proceed to post a message in Teams.

nap123_1-1642403209438.png

I am using this to compare date from excel with this

formatDateTimeformatDateTime(utcNow(), 'yyyy-MM-ddT00:00:00.000Z')
 
And in Excel I have dates in such type as it is seen in the picture
nap123_2-1642403401767.png

I would love any help and would really be thankful if anybody knew how to solve my problem. 

 
6 REPLIES 6
tom_riha
Super User
Super User

Hello @nap123 ,

try to add a 'Compose' action before the 'Condition' and store the Date from Excel in that 'Compose'. You'll then see in the flow run history what value was returned from the Excel and you can adjust the today's date accordingly.

But in general, when comparing dates in Power Automate, you should always use the ISO format 'yyyy-MM-dd' everywhere (if you don't need the time). That means using the formatDateTime(...) expression on both sides of the 'Condition' to convert the date from Excel and the utcNow(...) date.

 

The other option would be to filter the rows directly in the 'List rows present in a table' action, without the need to loop through all the rows, which I wrote about some time ago.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Thanks for the suggestion, but if I understand what you are saying is that I put if formatDateTime() is the same as 

formatDateTimeformatDateTime(utcNow(), 'yyyy-MM-dd') ? I am having problems with what to type in the thing that I am comparing. Could you help me and give me a clue to what I need to write.
 

On the left side, you must remove the time from the DATUM dynamic content. Go to the expression tab and use the formatDateTime(...) expression to format the date:

formatDateTime(<DATUM dynamic content>, 'yyyy-MM-dd')

on the right side, you want to format the today's date to the same format. Since the utcNow(...) expression allows you to format the date directly, you can use just the expression below.

utcNow('yyyy-MM-dd')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

I still get a error when trying to put in the left side value. I always get this error

"The term was invalid"

@tom_riha 

 

 I also tried to put in the dynamic content DATUM but when I choose  dynamic content only two things come up

nap123_0-1642589139179.png

 

tercet
New Member

Same problem as above is this resolved. only body and value is coming up 

Hello @tercet ,

you can enter the dynamic content as an expression, just check the JSON for the right value and extract it.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,444)