Extracting only a date from an Excel cell (e.g. "12/9/2021 [1 of 2]" ), I need to drop the part after 2021

Hi everyone, I have a simple question about StudioX (not Studio).

Suppose I have a row of dates, how do I get only the dates and drop additional info? Is there a UiPath method or an Excel function to help with that?

For example:

12/10/2021
12/5/2021
12/3/2021 (2/3)
12/3/2021 (1/3)

I just need it to go row by row and grab dates for later manipulation, but need a way to remove the parts in parenthesis.

Alternatively, if there’s just absolutely no way to do it, I’d settle for UiPath to just skip rows (For Each Row) where the date isn’t in the format I want.

Thank you!

Hi @dante1st

You can try like this (If you)

If row(“Date”).tostring.contains("(")
Assign split(Row(“Date”).tostring,"(")(0)
image

Regards
Sudharsan

Hello Sudharsan, thank you for responding so quickly. I have a follow up question.

How do I type that formula in Excel? It’s giving me an error.

So if my date is in the cell A1, and it says ’ 12/31/2021 (1/3) ’ , how should the formula look?

Hi ,

For excel formula ,

The =MID(cell,start_position,number_of_characters ) can be used.
Example
=MID(A1,1,10)

Hi Priyanka, I tried the formula, and although it works for a date such as 12/3/2021 (1/3), when I use it on a date that doesn’t need a conversion (such as 12/10/2021), it returns something like 44540.

Is this the expected behavior?

When I use the For Each Row function in UiPath, I was hoping to go row by row and grab dates, but if this particular function only works on the incorrectly formatted dates, I’m wondering if there’s another workaround.

The excel column is in number format , Try by changing Date or custom or general.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.