How to write if condition to check cell is empty or not and date in Date column is less than or equal to today date

i want to write the condition in while loop to check the ‘Status’ column is empty or null and date in the Date column is equals to or less than today’s date. i want to write this condition in while loop how to write that

There’s a typo at the beginning. It should be String.IsNullOrEmpty.

To compare the dates, don’t convert to string. If Date column is a datetime datatype, you can compare row("Date") directly to Now. Do not use ToString in this way.

If the datatype is an object or string where the date is formatted as “01/05/2020” (for today’s date), then use this after And:

DateTime.ParseExact(row("Date").ToString, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) <= Now.

2 Likes

@Anthony_Humphries sorry it is for if condition i have date in the format of MM/DD/YY in excel and when i was pasting that condition i was getting an error can

you please check it

@Anthony_Humphries i have edited the condition as you suggested but i was getting the error as above

The parentheses aren’t closed on String.IsNullOrEmpty.

@Anthony_Humphries if don’t mind can you please write the complete condition once I need it in urgent please

I want to check the date in the date column cell is equal to today’s date or previous date

Just put a ) after row("Status").Tostring, and you’re done.

1 Like

@Anthony_Humphries And for to check the date what should I use the previous one or one you suggested

Use the one in your most recent screenshot.

@Anthony_Humphries you mean this one

DateTime.ParseExact(row("Date").ToString, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) <= Now .

Yes, that’s the one.

@Anthony_Humphries Ok I will try and update you soon