How to put condition for two columns

Book1.xlsx (1.2 MB)
this is the data

can you help me with how to change the date 01-01-2023 into month january

try this for your input it will work

Dim startDate As New DateTime(2023, 12, 1)
Dim endDate As New DateTime(2023, 12, 31)
Dim DateModify As  String
Dim AcknowledgmentModify As  String
For Each r As DataRow In in_dt.AsEnumerable()
	If(Not r("Date").ToString.Equals("") And Not r("Acknowledgement").ToString.Equals(""))Then
		
		If(Not r("Date").ToString.Equals("NA") And Not r("Acknowledgement").ToString.Equals("NA"))Then	
			If Not String.IsNullOrEmpty(r("Date").ToString) And  Not String.IsNullOrEmpty(r("Acknowledgement").ToString) Then
		
				DateModify=System.Text.RegularExpressions.Regex.Match(r("Date").ToString,"[0-9\\\/\-]+").Value.Trim
				AcknowledgmentModify=System.Text.RegularExpressions.Regex.Match(r("Acknowledgement").ToString,"[0-9\\\/\-]+").Value.Trim
		
				Try
					If  Convert.ToDateTime(DateModify).ToString("yyyy/MM/dd") >= convert.ToDateTime(startDate).ToString("yyyy/MM/dd") AndAlso  Convert.ToDateTime(DateModify).ToString("yyyy/MM/dd") <= convert.ToDateTime(endDate).ToString("yyyy/MM/dd") And Convert.ToDateTime(AcknowledgmentModify).ToString("yyyy/MM/dd") >= convert.ToDateTime(startDate).ToString("yyyy/MM/dd") AndAlso  Convert.ToDateTime(AcknowledgmentModify).ToString("yyyy/MM/dd") <= convert.ToDateTime(endDate).ToString("yyyy/MM/dd") Then
    					r("c3")="date and acknowledgment is winthin month"
					Else
    					r("c3") = "Not date and acknowledgment is winthin month"
					End If
				Catch ex As SystemException
					If  DateTime.ParseExact(DateModify.ToString, "d/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd") >= convert.ToDateTime(startDate).ToString("yyyy/MM/dd") andalso  DateTime.ParseExact(DateModify.ToString, "d/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd") <= convert.ToDateTime(endDate).ToString("yyyy/MM/dd") And DateTime.ParseExact(AcknowledgmentModify.ToString, "d/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd") >= convert.ToDateTime(startDate).ToString("yyyy/MM/dd") andalso  DateTime.ParseExact(AcknowledgmentModify.ToString, "d/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd") <= convert.ToDateTime(endDate).ToString("yyyy/MM/dd") Then
    					r("c3")="date and acknowledgment is winthin month"
					Else
    					r("c3") = "Not date and acknowledgment is winthin month"
					End If	
				End Try
			Else
				r("c3") = "Date or  Acknowledgement is blank"
			End If
			Else
				r("c3") = "Data is missing"
		End If
		Else
			r("c3") = "False"
	End If
Next

output :

@anjani_priya

can we specify this month without mentioning the month

no i think we need to know which one is month

@anjani_priya

I need to change the data as if 1-02-2023 then it should change as january 2023
in the column there are so much rows but it should pick only date and change that as mmm-yyyy format

you can try this way

DateTime.ParseExact("01-02-2023", "M-dd-yyyy", CultureInfo.InvariantCulture).ToString("MMMM yyyy")

output :- :slight_smile:

@anjani_priya

there are other values also in the column but it should capture only date

Book1.xlsx (1.4 MB)
this is the data

Hi @anjani_priya

Please try this it is working

Cheers!!

you can try this in assign activity

dt = dt.AsEnumerable().Where(Function(row) DateTime.TryParseExact(row("Date").ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, Nothing)andalso DateTime.TryParseExact(row("Acknowledgement").ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, Nothing)).CopyToDataTable()

Note : Mention your Column Names

@anjani_priya

its taking more time

@anjani_priya

Input (1).txt (536 Bytes)

Book1 (14).xlsx (1.3 MB)

its taking more time to execute

Capture95

Hi @anjani_priya

You need to enable Macro Settings in Excel

Open Excel Click on Options->Trust Center->TrustCenter Settings->Macro Settings->Enable below options

i have did this.I have enabled the check box

iam getting this error

@anjani_priya

Click on Debug and show the error message

image