Populate or overwrite data in excel based on some condition

@SunnyJha

' Assuming dt is your DataTable

' Initialize a variable to store the last "Retail" package value found
Dim lastRetailPackage As String = ""

' Iterate through each row in the DataTable
For Each row As DataRow In dt.Rows
    ' Check if the current row's Keyword column value is "Retail"
    If row("Keyword").ToString().Equals("Retail") Then
        ' Update the last found "Retail" package value
        lastRetailPackage = row("Package").ToString()
    ElseIf row("Keyword").ToString().Equals("Volume") Then
        ' If the current row's Keyword is "Volume", update its Package column with the last found "Retail" package value
        row("Package") = lastRetailPackage
    End If
Next


Output