Filter Date column from data table

Hello Everyone,

I am stuck while filtering the Date Column in Excel using UiPath. I need to get the latest dates and these dates should fall between Wednesday to Saturday. How can i filter the date column based on the above condition.

Kindly help me with the same

Regards,
Sneha

Hi @sneha_arbole ,

Could you maybe explain in a bit more detail as to what is meant by latest dates ? What is the Date range that you are looking for ?

Hi @sneha_arbole

use the “Filter Data Table” activity to filter the data based on your conditions. Click on the “Edit Filter” button to define the filter conditions.

  • Select the column containing the dates in the “Column Name” drop-down list.
  • Choose the “Custom” option in the “Operator” drop-down list.
  • In the “Expression” field, enter the following formula:

=#Wednesday# AND <=#Saturday#

This formula will filter the dates that fall between Wednesday and Saturday, inclusive.

Thanks!!!

Hi @Nitya1

We don’t have Custom option in the Operator drop-down for Filter Data Table Activity.

And i need only latest Dates that fall from Wednesday to Saturday & not all.

Hi @supermanPunch

I have a Date column in my excel where all the dates are listed since 2018. I want the latest dates that is from Wednesday to Saturday only.
For ex. if i run my bot today the latest dates my bot should pick is 05/10/2023 to 05/11/2023.
If i execute the process on Monday then the latest date would be from 05/10/2023 to 05/13/2023

Hello @sneha_arbole

Try this,
It may help.

dt.AsEnumerable.Where(Function(r) CInt(CDate(r(“Date”).ToString).DayOfWeek)>2 AndAlso CDate(r(“Date”).ToString)>DateTime.Now.AddDays(-5) AndAlso CDate(r(“Date”).ToString)<= DateTime.Now ).ToArray.copytodatatable

Thanks.

1 Like

Hi @pravupada

This works for the current week.
Would like to know that if the process is executed on Monday or Tuesday will it pick the last weeks dates from excel?

@sneha_arbole

It will work for recent wednesday to saturday,
Whether ot is in current week or previous week.

Thanks.

Thank you for the clarification.

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