Dear community,

I am having trouble identifying the row index based on this cell (red circle)?

Can someone help me solve this problem?

Dear community,

I am having trouble identifying the row index based on this cell (red circle)?

Can someone help me solve this problem?

Hi,

How about to use LookUpRange activity as the following?

This returns address string. We can extract row number from it using the following expression.

```
System.Text.RegularExpressions.Regex.Match(strAddress,"\d+$").Value
```

OR

```
CInt(System.Text.RegularExpressions.Regex.Match(strAddress,"\d+$").Value)
```

Regards,

nope. i just realised that i am not using the modern experience.

But when i enable it, i found it.

1 Like

Can we define the keyword?

Because in my case, i have 3 keyword which is 2022,2 and apr.

Hi @JustZaffan

If you want to find the index only then youc an try thsi as well

`dt.rows.indexOf(dt.AsEnumerable.Where(function(x) x(0).ToString.Equals("2022") AND x(1).ToString.Equals("2") AND x(2).ToString.ToLower.Equals("apr")).FirstOrDefault)`

This will directly give you the index of matched row

you can change the conditions as per need

cheers

Hi @Anil_G ,

for find/replace value activity,

can we specify the value to find based on conditions?

for example, i have 3 condition.

let say it passed this 3 condition, it will select that cell.

Hi @JustZaffan

Please see my previous comment â€¦That way you can give multiple conditions

copying the same here

`dt.rows.indexOf(dt.AsEnumerable.Where(function(x) x(0).ToString.Equals("2022") AND x(1).ToString.Equals("2") AND x(2).ToString.ToLower.Equals("apr")).FirstOrDefault)`

dt is the datatable you have data in

Output is an interger directly assign the value to a integer variable

cheers

Hi,

FYI, another approach

We can use ForEachExcelRow for it in modern excel as the following.

Regards,

Hi @JustZaffan

It might be because the values might have spaces after every tostring try including a trim and it should work

Or instead of equals use contains

cheers

Try this it worked

`dt.rows.indexOf(dt.AsEnumerable.Where(function(x) x(0).ToString.Contains("2022") AND x(1).ToString.Contains("2") AND x(2).ToString.ToLower.Contains("apr")).FirstOrDefault)`

Input

output

cheers

Just wondering

if the condition has 3 value to consider, we can also add â€śandalsoâ€ť for the thrird condition

currentrow(â€śyearâ€ť).tostring = â€ś2022â€ť and also currentrow(â€śmonthâ€ť).tostring = â€śaprilâ€ť currentrow(â€ślineâ€ť).tostring = â€ś1â€ť

Yes, like the following.

```
currentrow("year").tostring = "2022" andalso currentrow("month").tostring = "april" AndAlso currentrow("line").tostring = "1"
```

Regards,

it still return -1,

just to be clear

dt.rows.indexOf(dt.AsEnumerable.Where(function(x) x(0).ToString.Contains(â€ś2022â€ť) AND x(1).ToString.Contains(â€ś2â€ť) AND x(2).ToString.ToLower.Contains(â€śaprâ€ť)).FirstOrDefault)

is it x(0) in statement above refer to the first column?

Hi @JustZaffan

Yes x(0) refers to the first column

index start from zero

You can as well give column names instead of index

cheers

i already try to run the work flow as per suggested by you.

it not works.

it just run through the whole row and end without any return current index

HI,

Can you share your worksheet? itâ€™s no problem if dummy data.

Regards,