How to get the adjacent value in cell based on the matching keyword in Excel sheet?

AdjacentTask.xlsx (9.7 KB)

1 Like

I need the value which is next to the “Div” keyword in this sheet! Is anyone can share the solution???

1 Like

You have two ways to do if the values are in the only two columns @Sathish_shankar

If the values are fixed in only M and N columns, and the operations are not duplicate, then you can use dictionary here

Can you let me know, if you want to retrieve all values corresponding to “Div” in the sheet?

No!! Values are not fixed in any particular columns it might be in anywhere in the sheet?

And you will have the string “Div” multiple times right?

@HareeshMR yes only for the string “Div” need to pick up the adjacent value.

@Sathish_shankar If your table range just M and N columns and you want to get data based on operations column value then you can use the select method of datatable to get required value after reading the values from excel and storing the data in datatable(dt).

String str=“Mul”

dataRow arr = dt.Select("[Operations]=’"+str+"’")

arr(0)(“Values”) gives data as 787 if single value is present in “Operations” Column.

You can use for each loop if duplicate data is present in “Operations” cloumn to get multiple values from “Values” column.

For each Column check if the Column Contains DIV if it contains read the next two columns then do a filter with DIV as keyword and get the adjacent value as
cellValue = datatable.Rows[1][“column_name”]

@WhenCutEsh To get adjacent value??

@Sathish_shankar Check below workflow and let me know.

Test.xaml (14.6 KB)

1 Like

yes why ??

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