StudioX/ Calculating the difference between two days within a for each row

Hey,

I have been desperately trying to resolve this issue for hours to no avail.

StudioX uses US date formatting by default, even if your excel is configured in another date formatting. I am trying to calculate the difference between two dates, that are formatted correctly in my file as dd/MM/yyyy. The automation will always use MM/dd/yyyy.

I have tried everything, and my most hopeful solution up to now has been creating a Date Reformatter sheet in the Project Notebook, which looks like this (formatting in my language):

image

Now, despite the excel function on each cell within each row of my iteration being along the lines of:
image

Apparently the output is:
image

When testing the same formula just using my a new blank excel file, I get the wanted result, which would be 57 (days). Help needed!

@Nikolaos_Brezas

Did you try using excel formula directly

and do a auto fill range to fill the formula all the way down?

cheers

  • Ensure both date cells are real Date values, not text.
  • Explicitly convert using Excel formulas, for example:
    =DATEVALUE(TEXT(A1,"dd/mm/yyyy")) - DATEVALUE(TEXT(B1,"dd/mm/yyyy"))
  • Or handle it in UiPath using Text to Date activity with Culture = en-GB, then subtract the Date variables.
  • Avoid relying on Excel’s displayed format; always force culture-aware date conversion.