Ask Your Question
0

Function to get the column name of a cell?

asked 2020-06-04 23:09:52 +0100

afroveo gravatar image

How to get the column name of a cell?

For example what function can I use in the cell B3 so that the return value is the column name "B"?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-06-04 23:20:54 +0100

Opaque gravatar image

updated 2020-06-04 23:43:56 +0100

Hello,

=REGEX(ADDRESS(ROW(),COLUMN(),4),"(.+)(\d+)","$1") should work

Update According to @keme's comment (thanks for that)

=REGEX(ADDRESS(ROW(),COLUMN(),4),"([:alpha:])(\d+)","$1") --or--
=REGEX(ADDRESS(1,COLUMN(),4),"([:alpha:])(\d+)","$1")

But anyway - solution using SUBSTITUTE() and taking into account that row isn't important at all is much simpler.

Hope that helps

edit flag offensive delete link more

Comments

1

The (.+) uses greedy matching, which catches digits from row 10 onwards. Add a question mark for lazy matching. =REGEX(ADDRESS(ROW(),COLUMN(),4),"(.+?)(\d+)","$1")

keme gravatar imagekeme ( 2020-06-04 23:32:41 +0100 )edit

thank you!

afroveo gravatar imageafroveo ( 2020-06-15 13:50:26 +0100 )edit
1

answered 2020-06-04 23:15:03 +0100

afroveo gravatar image

I found the solution

=SUBSTITUTE(ADDRESS(1;COLUMN();4);"1";"")

in another question: https://ask.libreoffice.org/en/questi...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-06-04 23:09:52 +0100

Seen: 202 times

Last updated: Jun 04 '20