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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need Help Converting E...
Power Automate
Unanswered

Need Help Converting Excel Formula Dates (Float Values) to Actual Dates in Power Automate

(0) ShareShare
ReportReport
Posted on by 15

Hello everyone,

I’m building a flow in Power Automate that references an Excel table stored on SharePoint. The spreadsheet has columns containing formulas for employee probation periods (e.g., 420h and 840h). These formulas can return a numeric “date serial” (like 45569) or sometimes an empty cell/text if the calculation doesn’t apply. I need to:

  1. Compare each row’s “date” to today’s date (to see if the period ends today).
  2. Send an email alert if it matches today.
  3. Update the same row with a timestamp once the email is sent.
 

However, I keep running into template expression errors when trying to use int(), and so on, especially if the cell is empty, has text, or if it’s a float instead of an integer. For example:

  • Error: Unable to process template language expressions in action 'Set_variable' inputs at line '0' and column '0': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
 
The expression used in Set variable : 
 
if(
    and(
        not(empty(items('Apply_to_each')?['EVAL_x002e_840H'])),
        not(equals(items('Apply_to_each')?['EVAL_x002e_840H'], '1900-01-00')),
        not(equals(items('Apply_to_each')?['EVAL_x002e_840H'], null))
    ),
    formatDateTime(
        addDays('1899-12-30', int(string(items('Apply_to_each')?['EVAL_x002e_840H']))),
        'yyyy-MM-dd'
    ),
    null
)
 
Despite these attempts, some rows still cause the flow to fail if they contain non-numeric data or if the date serial has decimals. I’m also aware that Power Automate doesn’t directly support a floor() function.
 
 

My questions for the community:

What’s the best practice for handling date serials (especially with fractional parts) in Excel-based flows?

 

Any guidance or recommended patterns would be greatly appreciated. Thanks in advance for your help!
 
Categories:
I have the same question (0)
  • Suggested answer
    SwatiSTW Profile Picture
    741 Super User 2025 Season 2 on at

    Here is how you can fix the issue step by step

    1. Start by initializing two variables: one for today's date (use utcNow() as the value) and another for the processed date (leave it empty for now).

    2. Use the "List rows present in a table" action to get data from your Excel file stored in SharePoint or OneDrive.

    3. Add an "Apply to each" loop to go through each row in the Excel table.

    4. Inside the loop, add a "Compose" action to check the value of the column with the Excel date serial (like EVAL_x002e_840H). This is just for debugging.

    5. Add a "Set variable" action to calculate the real date. Use this expression to convert the Excel date serial into a proper date

    if(
    and(
    not(empty(items('Apply_to_each')?['EVAL_x002e_840H'])),
    or(
    isFloat(items('Apply_to_each')?['EVAL_x002e_840H']),
    isInt(items('Apply_to_each')?['EVAL_x002e_840H'])
    )
    ),
    formatDateTime(
    addDays('1899-12-30', int(items('Apply_to_each')?['EVAL_x002e_840H'])),
    'yyyy-MM-dd'
    ),
    null
    )
    1. Add a "Condition" action to check if the processed date (from the variable) matches today's date (from the variable you initialized earlier). Use this expression
    equals(variables('ProcessedDate'), variables('DateAujourd\'hui'))
    1. If the condition is true, add an action to send an email. This will notify the person about the probation period.

    2. Also, if the condition is true, update the same Excel row to add a timestamp or mark the row as processed.

    3. If there are any invalid or empty rows, the flow will skip those rows automatically because of the expression in step 5.

    4. Test the flow and adjust as needed. Use "Compose" actions to see the values at each step if something doesn’t work.

  • Suggested answer
    David_MA Profile Picture
    12,966 Super User 2025 Season 2 on at
    If I understand correctly, you want to know how to convert an Excel serial date to a regular date? If those, use this expression: addDays('1899-12-30',int(triggerBody()['number_1']),'dd-MM-yyyy')

    Replace triggerBody()['number_1'] with the value from Excel.
  • 3xceln4ute Profile Picture
    15 on at
    Hi,
     
    Thnak you for your replies. However, the issue is stille ongoing.
     
    The expression used in "Set variable":
    if(
      and(
        not(empty(items('Apply_to_each')?['EVAL_x002e_840H'])),
        or(
          isFloat(items('Apply_to_each')?['EVAL_x002e_840H']),
          isInt(items('Apply_to_each')?['EVAL_x002e_840H'])
        )
      ),
      formatDateTime(
        addDays('1899-12-30', int(triggerBody()?['EVAL_x002e_840H'])),
        'yyyy-MM-dd'
      ),
      null
    )
    The expression used in "Condition 840h" connector :
    equals(variables('DateConvertie 840h'), variables('DateAujourdhui'), utcNow('yyyy-MM-dd'))
     
     
    This situation is driving me crazy, as it seems that there is no solution...

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard