How to get value based on another value in excel?

Hi All,

Scenario:-

I need to fetch amount value and I don’t have header name.
Amount and 717(value ) is in same row.

Can anyone suggest, how to get that value?

Read the excel & go to for each in that loop search with the particular key & get the value

Hi ShuklarChana001

You can use linq to get the value.

Hi @shuklarchana001 ,

Is this maybe what you were looking for?

image

Convert.ToInt32(dt_sampleData.
	AsEnumerable().
	Where(Function(w) w(0).ToString.Contains("Amount")).
	Select(Function(s) s.ItemArray.Where(Function(sw) sw.ToString.IsNumeric).FirstOrDefault).
	FirstOrDefault())

This ofcourse, is just a rough code, we have to add proper checks to ensure that we are indeed getting the item that we want and not something unexpected.

RetrieveLastIteminRow.xaml (8.2 KB)

Kind Regards,
Ashwin A.K

1 Like

I have ran same but getting 0.

image

I think this amount value is not in last row.

Hi @shuklarchana001 ,

Would you be so kind as to share a sample template so that I can experiment with it?
That would be most appreciated.

Kind Regards,
Ashwin A.K

Hey @ashwin.ashok , you were correct.

It is working. Actually, I did put other value.

@ashwin.ashok Thank you so much for your help

1 Like

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