In spreadsheet, Can I get the row number and column number of the current cell?

Nicholasfox shared this question 1 year ago
Answered

I'm tring to get a matrix like the picture attached.

With Excel, I can easily finish this task by: =IF(ROW()<=COLUMN(),POWER(COLUMN()-1,2)+ROW(),POWER(ROW()-1,2)+2*ROW()-COLUMN())

In GGB, I faced two difficult.

1. row() and column() need a parameter, I can't get the row and column number of the current cell.

2. absolute reference is not surpported in row command. row(A1) works, but row($A1) does not.


Please help.

Files: a.jpg

Comments (3)

photo
1

Input this into cell B2, It worked.=If(Row(A1) ≤ Column(A1) , (Column(A1) - 1)² + Row(A1), (Row(A1) - 1)² + 2Row(A1) - Column(A1))

photo
1

Regarding the effort for creating and maintaining the table, I consider a solution using Sequence() and a small script to be better.

See attachment.

photo
1

Thank you very much.

photo
© 2023 International GeoGebra Institute