Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 19
Default Column Name Formula

This should be an easy one:

Is there a function that returns the name of the column (A,B,C,....) just
like there is one for row, but returns the static value of the column (A,B,C)
and not just a column number??

I can do it by setting up a table and associating 1 with A, 2 with B, and so
on...but that's anoying especially if I am expecting to go past the 26 letter
alphabet into the combinations.

Thanks for any help!!!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 964
Default Column Name Formula

The CELL function can return the address of a cell.

=CELL("address",A1)

This returns the value: $A$1

You could manipulate this result to show just the column letter.

=MID(CELL("address",A1),2,FIND("$",CELL("address", A1),2)-2)

This would just return: A

HTH,
Elkar


"masterbaker" wrote:

This should be an easy one:

Is there a function that returns the name of the column (A,B,C,....) just
like there is one for row, but returns the static value of the column (A,B,C)
and not just a column number??

I can do it by setting up a table and associating 1 with A, 2 with B, and so
on...but that's anoying especially if I am expecting to go past the 26 letter
alphabet into the combinations.

Thanks for any help!!!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Column Name Formula

This UDF will give you the column letter.

Function GetColLet(ColNumber As Integer) As String
GetColLet = Left(Cells(1, ColNumber).Address(False, False), _
1 - (ColNumber 26))
End Function

=getcollet(167) returns FK

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the above code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Enter the formula as shown above.


Gord Dibben Excel MVP


On Tue, 25 Jul 2006 14:41:02 -0700, masterbaker
wrote:

This should be an easy one:

Is there a function that returns the name of the column (A,B,C,....) just
like there is one for row, but returns the static value of the column (A,B,C)
and not just a column number??

I can do it by setting up a table and associating 1 with A, 2 with B, and so
on...but that's anoying especially if I am expecting to go past the 26 letter
alphabet into the combinations.

Thanks for any help!!!


Gord Dibben MS Excel MVP
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
how can i multiply two columns edgar Excel Worksheet Functions 7 March 2nd 06 03:29 PM
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Positioning Numeric Values Resulting from 6 Column Array Formula Sam via OfficeKB.com Excel Worksheet Functions 2 January 5th 06 02:03 AM
Match then lookup Tenacity Excel Worksheet Functions 9 December 3rd 05 05:30 AM


All times are GMT +1. The time now is 10:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"