Check condition with 2 file

I have excel 2 files.
I want to check input file with master file (sheet Correct).

I want check if 3 step
scenrio 1
if step1 true —> message box “step1” —> check next row in input file

scenrio 2
if step1 false ----- check step2 —> if step2 true message box “step2” —> check next row in input file

scenrio 3
if step1 false -----> check step2—> if step2 false ----> check step3 ----> f step2 true message box “step3” —> check next row in input file

scenrio 4
if step1 false -----> check step2—> if step2 false ----> check step3 ----> if step3 false -----> message box “not” —> check next row in input file

step as below.

  1. Check column C from file input with column C file master If match check column J not empty cell and not value =“working”
  2. Check column C from file input with column C file master If match check column E if match in column E file master ----> check column J = “working” or empty cell
  3. Check column C from file input with column C file master If match check column J = “working” or empty cell

Please guide me for solve it.

Thank you.

Input.xlsx (10.9 KB)
Master.xlsx (493.3 KB)

Anyone can guide me for solve it?

Thank you.

Hi @fairymemay

Check out the below zip file. Hope this meets your requirement.

BlankProcess36.zip (505.4 KB)

Regards

1 Like

For Each row in inputDT
// Perform the lookup to see if Column C in inputDT exists in masterDT
matchedRows = masterDT.Select(“ColumnC = '” + row(“SR #”).ToString + “'”)

If matchedRows.Length > 0
    masterRow = matchedRows(0) // Take the first matched row for comparison

    // Scenario 1
    If masterRow("ColumnJ").ToString <> "" AndAlso masterRow("ColumnJ").ToString.ToLower <> "working"
        MessageBox.Show("step1")
    Else
        // Scenario 2
        If row("ColumnE").ToString = masterRow("ColumnE").ToString AndAlso (masterRow("ColumnJ").ToString.ToLower = "working" OrElse String.IsNullOrEmpty(masterRow("ColumnJ").ToString))
            MessageBox.Show("step2")
        Else
            // Scenario 3
            If masterRow("ColumnJ").ToString.ToLower = "working" OrElse String.IsNullOrEmpty(masterRow("ColumnJ").ToString)
                MessageBox.Show("step3")
            Else
                MessageBox.Show("not")
            End If
        End If
    End If
Else
    MessageBox.Show("not")
End If

Next row

1 Like

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