As an example in the above situation, JOHN is used as an example, and the name is included in the variable NameCheck.
I want to check the same name and the day in the DateCheck and put the value in the Time Check in the box. There are many names
NameCheck = “JOHN” ’ The name to check
DateToDay = 13 ’ The day to check
TimeCheck = 2 ’ The value to set
For Each row in dtSchedule
If row(“NameColumn”).ToString.Equals(NameCheck)
Assuming the first date column starts at index 1 or column “B”
Adjust the column index based on where your date columns start
dateColumn As String = (DateToDay + 1).ToString ' "+1" because of zero-based index
If Not String.IsNullOrWhiteSpace(row(dateColumn).ToString) AndAlso CInt(row(dateColumn).ToString) = DateToDay
Set TimeCheck value
row("TimeCheckColumn") = TimeCheck
Suppose you have these three variables
NameCheck = “JOHN”
DateToDay = 13
TimeCheck = 2
Read you Excel file - dtSchedule
Use For Each row of iterating
Use If condition - row(“NameColumn”).ToString.Equals(NameCheck)
In the Then Section use Another If Condition - Not String.IsNullOrWhiteSpace(row(dateColumn).ToString) AndAlso CInt(row(dateColumn).ToString) = DateToDay
If true, use an Assign activity to set row("TimeCheckColumn") to TimeCheck
Use the “Write Cell” activity within the Then section of the second “If”.
For the “Write Cell” activity, you need to calculate the cell reference dynamically based on the row index within dtSchedule and the column for the TimeCheck.
The cell reference will be like "E" & (dtSchedule.Rows.IndexOf(row) + 2).ToString() if E is the TimeCheck column.
Sequence
Assign: NameCheck = “JOHN”
Assign: DateToDay = 13
Assign: TimeCheck = 2
If (Condition: NameCheck = “JOHN” AND DateToDay = 13 AND TimeCheck = 2)
Type Into “Time Check” with the desired value
(Optional) Log Message: “Condition met. Typing into Time Check.”
Else
(Optional) Log Message: “Condition not met.”
End