Solved

How do you get the alpha value for a column

Posted on 2014-09-09
9
193 Views
Last Modified: 2014-09-09
Related question:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28512271.html

I have often used the COLUMN() function to get the numeric value of a column, including in this question. Is there a way to get the alpha value for a column instead? I have currently managed it with this extremely long formula:

=ADDRESS(MATCH(RIGHT(AA33,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&":$"&MID(ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1))),FIND("$",ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1))),1)+1,FIND("$",SUBSTITUTE(ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1))),"$","",1),1)-FIND("$",ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1))),1))&"$"&MATCH(RIGHT(AA33,1)+1,$Z$1:$Z$38,0)-1

This generates a cell range address:

'Charge Lines'!$AB$2:$AB$16

 The ADDRESS function provides the first section up to the colon and is then repeated within the following section to generate the same text from which to extract the value.

The section in bold gives the alpha value for the column.
CELL("filename",$A$1)  ensures the sheet name stays correct within the ADDRESS function
FIND "$" gives position of first $ within the address, the first occurence being just before the column reference so +1 for start position for MID function
SUBSTITUTE removes the first $ and then FIND gives position of second $ within the ADDRESS
Second $ less first $ gives length of column reference for number of characters in MID function.

Row numbers for ADDRESS function and then after the above extraction of column reference are achieved by using MATCH to find a week number in a different column.

Hope that explains how the above is working.

Any suggestions for making simpler. The file is Macro Enabled so would consider use of a User Defined Function.

Example file attached with cells highlighted.

Thanks
Rob H
Dummy-Time-bookings.xlsm
0
Comment
Question by:Rob Henson
  • 5
  • 4
9 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40311729
Hi,

pls try for example

=LEFT(ADDRESS(1,COLUMN(AA39),4,),LEN(ADDRESS(1,COLUMN(AA39),4))-1)

EDIT for your example

you could use LEFT(ADDRESS(1,COLUMN(AA39),1,),LEN(ADDRESS(1,COLUMN(AA39),1))-1) to eliminate the need of the "$"

Regards
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40311747
Shorter

=SUBSTITUTE(ADDRESS(1,COLUMN(AA39),4,),"1","")
'OR
=SUBSTITUTE(ADDRESS(1,COLUMN(AA39),1,),"1","")
0
 
LVL 32

Author Comment

by:Rob Henson
ID: 40311755
Sorry,I am not understanding how the above suggestions would be incorporated into the formula. Please can you post the whole formula.

Thanks
Rob H
0
 
LVL 32

Author Comment

by:Rob Henson
ID: 40311771
Actually, got it figured out.

=ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&LEFT(ADDRESS(1,COLUMN(AB34),1,),LEN(ADDRESS(1,COLUMN(AB34),1))-1)&MATCH(RIGHT(AA34,1)+1,$Z$1:$Z$38)

Bizarrely enough, eventhough the above is in cell AB34, reference to AB34 within the formula doesn't result in a circular reference.

Much shorter than original. Amazing what another pair of eyes can do to change the logic path; I am normally not too bad for thinking outside of the box (if the box even exists??), I obviously got trapped within it on this occasion.

Thanks
Rob H
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40311784
pls try

=ADDRESS(MATCH(RIGHT(AA33,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&":"&SUBSTITUTE(ADDRESS(1,COLUMN(),1,),"1","")&MATCH(RIGHT(AA33,1)+1,$Z$1:$Z$38,0)-1
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40311799
it is not a circular reference because you do not use the value of the cell but its position
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 40311817
a bit shorter

=ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&":"&ADDRESS(MATCH(RIGHT(AA34,1)+1,$Z$1:$Z$38),COLUMN(AB34),1)
0
 
LVL 32

Author Comment

by:Rob Henson
ID: 40311834
Going with this one for Week 1:

=ADDRESS(MATCH(RIGHT(AA33,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&":"&SUBSTITUTE(ADDRESS(1,COLUMN(),1,),"1","")&MATCH(RIGHT(AA33,1)+1,$Z$1:$Z$38,0)-1

and a slight tweak for Week 2:

=ADDRESS(MATCH(RIGHT(AA34,1)*1,$Z$1:$Z$38,0),COLUMN(),1,1,RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1),1)))&":"&SUBSTITUTE(ADDRESS(1,COLUMN(),1,),"1","")&MATCH(RIGHT(AA34,1)+1,$Z$1:$Z$38)

Difference being the non-exact MATCH at the end finding the last occurence of 2 because it can't find 3.

Thanks
Rob H
0
 
LVL 32

Author Closing Comment

by:Rob Henson
ID: 40311837
Thank you for your continued support.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now