Colorado Techie
Colorado Techie

Reputation: 1332

Accessing the Cell Coordinates in custom function

Is there a way to access the cell coordinates (in A1 notation) of the cell that was passed in to my function?

For example, if my function is this

function displayA1Notation(myCell){
  return myCell.getA1Notation();
}

and I put the following in cell B4:

=displayA1Notation(C6)

I'm hoping to see this:

C6

But what I actually see is this:

Kansas

("Kansas" is the actual cell value of C6)

I know this seems easy... I'm just stuck in trying to get it to work.

Thanks~!

Upvotes: 6

Views: 2625

Answers (1)

megabyte1024
megabyte1024

Reputation: 8650

Spreadsheet custom functions arguments contain only values pointed as arguments and not cell addresses. This fact not clear documented but there are a couple of similar questions here, for instance, this one. There is a workaround by using the build-in function ADDRESS. like in the following code

=myFunc(ADDRESS(ROW(F8), COLUMN(F8)))

Upvotes: 3

Related Questions