Forum Discussion

bcsteeve's avatar
bcsteeve
Copper Contributor
Jan 04, 2024

Reference a cell by its contents?

As a formula, I'd generally use index() along with match().  How does one reference a cell by its contents in Office Script?

On WorkSheet1 in Column A I have a list of non-unique names, already sorted.  In Column B I have some data I want to change.
On WorkSheet2 I have a named cell "ID" at $B$2.  This is used to determine which row in WorkSheet1 we're working with.  I want to find the FIRST row which contains "ID" in Column A.

On WorkSheet3 I have the new data in A1 to be copied to WorkSheet1 (at $B$x)

When I click a button on WorkSheet3, I want the appropriate cell in WorkSheet1 (ie. the cell in Column B which is in the row where ID first matches in Column A) to change to match what is in a WorkSheet3 $A$1


Thanks.

Resources