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. 

 
4 REPLIES 4
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

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,742)