How to copy text in a cell if you know the value of the cell above it?


I am looking to copy the value of a cell which is going to be placed dynamically, however it will always be underneath a cell that has a static value, in this case “Project Name” (not a header)


1 Like

Hi @LeThomp

Maybe you can share more details like putting the screenshots of input and your desire output as well to easilly understand the issue. :smiley:

cheers :smiley:

Happy learnng :smiley:


Hi @pattyricarte,

Basically want to get the value of the Big cheese project as a variable based on the location of ‘Project Name’. Need the automation to detect where ‘Project Name’ is and copy the value of the cell below it. The Project name will always be in the same column, but the row is dynamic.



Hi, you can use select method here

  1. Use excel application scope with Read range to read the file , and the output is datatable variable ex:DT1

  2. Now create a datarow array variable ex:DR1
    Use assign activity
    DR1 ="[column of the Project name ] = ‘Project name’ ")

  3. Now create a int32 variable ex:Rownum
    use another assign activity
    Rownum = DT1.rows.indexof(DR1(0))

This will give you the row number of the ‘Project name’ value
4) Now use read cell activity
In the cell (input) property give as
Column alphabet+(Rownum+1)
Ex :G+(rownum+1)



You can use Look up DataTable activity and find Project Name word. Based on that you will find required data.


Hi Lakshman,

I have tried using this but it is coming back with incorrect data (the index is 3 behind where the actual text is.)

1 Like

Hi Vinay,

Thank you for your response. I am having trouble with the [column of the Project name ] part as the sheet has a dynamic column name for where this information can be found. Do you have any suggestions?


Is column position will change everytime ?


The column will be in the same position, however marking ‘A’ hasn’t been working for me. The row will be dynamic.

Then please use
For each row loop of DT1
Now inside for each row
use ‘Get row item’ activity and give the column index at the ‘column’ property
And take that value as output into variable ex:Var1
Use if condition
Var1.trim = “project name”
Rownum = DT.rows.indexof(row)
Now use
Now out side the for each row loop
Get cell activity
And at the cell input give as
“Cell name”+(rownum+1)

Ex : G(rownum+1) or B(rownum+1)


This worked, thank you very much @vinay_reddy!

Welcome !
Happy to help here
Happy Automation

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