I would like to Search the Column name "Date" and return its Column value, "D"

The title explains it all.

I have probably done this before - but I have been bashing my head (figuratively) for 2 hours now.
I’m sure the solution is rather simple.

Update:
Unresolved: The things I have tried below didn’t work because there were always undeclared variables - or their “protection level” prevented the declared variables from making the below work. I have yet to confirm.

But I think selecting “Has Headers” and than selecting a header - even though the range does not match the row the Header is in, still works for some reason. (this is in a ForEachRow activity)
Example. Range set to “Sheet2” - used to find the “FindValues” and their “ReplaceValues”

Header for the Range that the “FindValues” and their “ReplaceValues” are used in, is Excel.Sheet(“Sheet1”).Range(“Date”) - but “Date” is in the 4th row, unlike the headers for Sheet2.

I’ll mark vrdabberu’s solution as the solution - because it should work - I just wasn’t able to make it do so.

Hi @jezaia.vanderwatt,

Are you looking for something like this?

value = dt_YourDataTable(rowindex)(“Date”).toString

Juan P.

Hi @jezaia.vanderwatt

Try this

Convert.ToChar(64 + DT.Columns.IndexOf("Date End") + 1).ToString()

Input:

image

Regards,

Hi @jezaia.vanderwatt

Try this:
→ Read Range Workbook
image
Output-> dt
→ Use below syntax in Assign

Output = If(dt.Columns.Contains("Date"), Convert.ToChar(65 + dt.Columns.IndexOf("Date")).ToString(), "")

Output is of DataType System.String

Regards

Uh… maybe?

I want to use an activity which has the same effect as

Column Index Finding Activity
Range to Search in: Excel.Sheet(“Sheet1”).Range(“4:4”)
Value to search For: “Date”
Save Value to: Flexible_Column_Index

oh. lemme see if @vrdabberu 's solution works… ooh. that looks like the one.

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