Find row with expired date OR will expire within 7 days from current date

Hello,

I need ideas how to get this done. I have an excel sheet with huge numbers of rows. The aim is to find those rows(with “Item”) that date is already expired or will expire within 7 days. At first I need to filter it by column “Item” with latest date column “To date”.

For example, from my screenshot I should get only 3 rows:
… N123 … 06/11/2023
… N322 … 06/08/2023
… N898 … 06/10/2023

Does anyone have idea how to implement this?

@SomethingLikeThat

do you need to filter the column only having columnName as ToDate

can you explain more about your requirement

cheers

Hi @SomethingLikeThat ,

CurrentDate=DateTime.Now
Expirydate=DateTime.Now.AddDays(7)

Can you please try the below code,

(From row In DT.AsEnumerable()
Let dateValue = DateTime.Parse(row.Field(Of String)(“A”))
Where dateValue <= ExpiryDate AndAlso dateValue >= currentDate
Select row).CopyToDataTable()

Please change column names.

Thanks,
Sandhiya P

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