How do I get the coordinate of the cell that is found in a vlookup.
Hi @wes.hartmann ,
- Add a
Vlookup
activity to your workflow and configure it to search for the desired value in your spreadsheet. - Add a
Assign
activity to your workflow and create two variables:vlookupResult
of typeString
andcellCoordinate
of typeUiPath.Core.UiElement
. - In the
To
field of theAssign
activity, entercellCoordinate
. - In the
Value
field of theAssign
activity, use the following expression to extract theaaname
attribute of the cell that contains the Vlookup result:FindElement(By.Name(vlookupResult)).Get("aaname").ToString
This expression uses theFindElement
method to locate the cell that contains the Vlookup result, and then extracts the value of theaaname
attribute, which contains the cell coordinate. - Run the workflow and verify that the
cellCoordinate
variable contains the correct cell coordinate. You can use theMessage Box
activity to display the value of thecellCoordinate
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,
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
Try with the below following
- Use the “Read Range” activity to read the data range that contains the lookup value and the VLOOKUP table.
- Use the “Find” activity to search for the lookup value in the VLOOKUP table.
- 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))
- 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.