Get Header / Columnname as String Array for Columns containing a particular value

Hello BrainsTrust,

Would like help please. I have an excel datatable with 2 tabs. The first tab has staff email address and a row identifier for the second tab. i.e:

bob@you.com 4
steve@me.com 7
tom@them.com 2

The (eg: 4 or 7 or any other number associated with that email address from first tab) refer to the row on the second tab. The second tab has X’s in several (maybe not all) cells in that row. I want to return the column headers or each cell (in the row) that has a X in it, and return the whole result as an Array (of string)

image

I.E: Row 4 would return: {R1, XXs, xx}

I have this so far…what do i need to ADD to it, to make it work please:

dtbTEST.rows(4).ItemArray.OfType(Of String).ToArray

give a try on following

(From x in Enumerable.Range(0,dtbTEST.Columns.Count)
Where dtbTEST.Rows(YourRowIndex)(x).toString.Trim.Equals(“X”)
Select s = dtbTEST.Columns(x).ColumnName).toArray

1 Like

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