Remove rows that contains currentdate+1

Hi,

I have excel in which column name “Posting Date” contains dates. I need to remove all rows which contains the dates greater than or equal to current date +1. How to do this . Can someone help. I used for each loop and if activity but it takes so much time when there is large data. Please suggest

try filter datatable and make sure you select remove

under condition set datecolumn = Now.AddDays(1).ToString("dd/MM/yyyy")
this is assuming your date format is dd/MM/yyyy otherwise change it to your own format
image

will it work for >= operator?

try this

set condition to
Date >= Now.AddDays(1)
image

Hi @Sirisha_Siri ,

Check the Below Linq Expression :

DT = DT.AsEnumerable.Where(Function(x)Not(CDate(x("YourDateColumn").ToString)>=Now.AddDays(1))).CopyToDatatable

Here, DT is your Input Datatable, we can assign the filtered data back to the same datatable or Create a Clone of Input Datatable and assign the filtered data to it.

Let us know if the above Expression doesn’t work or it gives out an error.

Hi @supermanPunch

It is not working for my excel. Could you please have a look. Attaching code and excel file for reference

test.xaml (8.6 KB)

GL_List13_6_2022.xlsx (12.5 KB)

@Sirisha_Siri ,

Can you Check the Below Workflow :
test.xaml (10.4 KB)

The Query is Updated as below :

filtereddt.AsEnumerable.Where(Function(x)Not(CDate(x("Posting Date").ToString).Date>=Now.AddDays(1).Date)).ToArray

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