How to find count of today date in excel based on input value

Hi Team,

I have one excel data with date , based on input count and name should update one string value with today date (“Output” with today date)

I want only set condition today date count is less than input count
Please help me @RajKumar_DC

example input:
count : 4
Expected output:
Find the name YYY that same row count the today date is less than input count of 4 , if condition meet update today date of last cell of that same row value else skip

Please anyone help me on this.

excel sheet:

Please take reference below query:
(From row In dt_data.AsEnumerable
Let a = String.Join(“,”,System.Text.RegularExpressions.Regex.Matches(String.Join(“,”,row.ItemArray),“\b\d{2}.\d{2}.\d{2}\b”)).Split(CChar(“,”)).ToList
Let b = String.Join(“,”,a.Where(Function(x) x.ToString.Equals(Now.ToString(“MM.dd.yy”)))).ToList().Count=4
Let c = (String.Join(“,”,((String.Join(“,”,row.ItemArray)).Split(“,”.ToCharArray,StringSplitOptions.RemoveEmptyEntries)).toarray())+“,Output”+Now.ToString(“MM.dd.yy”)).Split(CChar(“,”))
Let d = If(row(“Name”).ToString.Equals(str_Name),c,row.ItemArray)
Select dt_data.Clone.Rows.Add(d)).CopyToDataTable

Raja G

Hi @supermanPunch, @ppr please help me for this

Hi @Raja.G,

You’re almost there, I have added it as per your request plz ceck this

(From row In dt_data.AsEnumerable
Let a = String.Join(",",System.Text.RegularExpressions.Regex.Matches(String.Join(",",row.ItemArray),"\b\d{2}.\d{2}.\d{2}\b")).Split(CChar(",")).ToList
Let b = String.Join(",",a.Where(Function(x) x.ToString.Equals(Now.ToString("MM.dd.yy")))).ToList().Count=4
Let c = (String.Join(",",((String.Join(",",row.ItemArray)).Split(",".ToCharArray,StringSplitOptions.RemoveEmptyEntries)).toarray())+",Output"+Now.ToString("MM.dd.yy")).Split(CChar(","))
Let d = If(row("Name").ToString.Equals(str_Name) And b,c,row.ItemArray)
Select dt_data.Clone.Rows.Add(d)).CopyToDataTable

if it is not work plz reply back with input excel file


@RajKumar_DC ,

Yes worked but i should add one if condition before above query that condition is what ever i give in input count value and name

Input YYY and 4

That name(YYY) row today date less than input count value than i pass above query
Input file:

The above query result paste to another sheet and format also changed,so i want that output is same sheet and same format

Please help this also

@RajKumar_DC ,

That query have that condition but i want set separate condition also, i couldn’t able to split that condition from that query

if you want to add < or > or = just change the condition above mentioned


Hi @Raja.G,

Try this

(String.Join(",",System.Text.RegularExpressions.Regex.Matches(String.Join(",",dt_data.Select("Convert(Name,System.String)='"+str_Name+"'").CopyToDataTable.Rows(0).ItemArray),"\b\d{2}\.\d{2}\.\d{2}\b"))).Split(","c).Where(Function(x) x=Now.ToString("MM.dd.yy")).Count<int_Count,


Hi @RajKumar_DC ,

Yes Working fine, Thank you so much.

Raja G

1 Like

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