VlookUp Function

How do I get the coordinate of the cell that is found in a vlookup.

Hi @wes.hartmann ,

  1. Add a Vlookup activity to your workflow and configure it to search for the desired value in your spreadsheet.
  2. Add a Assign activity to your workflow and create two variables: vlookupResult of type String and cellCoordinate of type UiPath.Core.UiElement.
  3. In the To field of the Assign activity, enter cellCoordinate.
  4. In the Value field of the Assign activity, use the following expression to extract the aaname attribute of the cell that contains the Vlookup result:FindElement(By.Name(vlookupResult)).Get("aaname").ToStringThis expression uses the FindElement method to locate the cell that contains the Vlookup result, and then extracts the value of the aaname attribute, which contains the cell coordinate.
  5. Run the workflow and verify that the cellCoordinate variable contains the correct cell coordinate. You can use the Message Box activity to display the value of the cellCoordinate variable for debugging purposes.

Thanks

HI,

Unfortunately, vlookup activity doesn’t return address. How about using ForEachExcelRow as the following?

Sample
NewBlankTask20230426-2.zip (59.7 KB)

Regards,

@wes.hartmann

After vlookup you can use a find/replace activity and pass the putput of vlookup to it and the output of it contains the cell number in it

Hope this helps

Cheers

Hi @wes.hartmann

Try with the below following

  1. Use the “Read Range” activity to read the data range that contains the lookup value and the VLOOKUP table.
  2. Use the “Find” activity to search for the lookup value in the VLOOKUP table.
  3. If the lookup value is found, use the “Assign” activity to get the cell address and row and column indices

cellAddress = foundCell.Address.ToString()
rowIndex = CInt(foundCell.GetRowItem(cellAddress))
columnIndex = CInt(foundCell.GetColumnItem(cellAddress))

  1. You can then use these values to perform further operations on the cell. For example, you could use the “Write Cell” activity to write a new value to the cell

cellValue = "New Value"
cellAddress = columnIndex.ToString() + rowIndex.ToString()

Write Cell activity: set the “Value” property to cellValue and the “Cell” property to cellAddress.

Regards
Gokul

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