Rob Henson
asked on
How do you get the alpha value for a column
Related question:
https://www.experts-exchange.com/questions/28512271/Using-INDIRECT-with-Dynamic-Range-Names.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),C OLUMN(),1, 1,RIGHT(CE LL("filena me",$A$1), LEN(CELL(" filename", $A$1))-FIN D("]",CELL ("filename ",$A$1),1) ))&":$"&MID(ADDRESS(MATCH(RIG HT(AA34,1) *1,$Z$1:$Z $38,0),COL UMN(),1,1, RIGHT(CELL ("filename ",$A$1),LE N(CELL("fi lename",$A $1))-FIND( "]",CELL(" filename", $A$1),1))) ,FIND("$", ADDRESS(MA TCH(RIGHT( AA34,1)*1, $Z$1:$Z$38 ,0),COLUMN (),1,1,RIG HT(CELL("f ilename",$ A$1),LEN(C ELL("filen ame",$A$1) )-FIND("]" ,CELL("fil ename",$A$ 1),1))),1) +1,FIND("$ ",SUBSTITU TE(ADDRESS (MATCH(RIG HT(AA34,1) *1,$Z$1:$Z $38,0),COL UMN(),1,1, RIGHT(CELL ("filename ",$A$1),LE N(CELL("fi lename",$A $1))-FIND( "]",CELL(" filename", $A$1),1))) ,"$","",1) ,1)-FIND(" $",ADDRESS (MATCH(RIG HT(AA34,1) *1,$Z$1:$Z $38,0),COL UMN(),1,1, RIGHT(CELL ("filename ",$A$1),LE N(CELL("fi lename",$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
https://www.experts-exchange.com/questions/28512271/Using-INDIRECT-with-Dynamic-Range-Names.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,
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
Shorter
=SUBSTITUTE(ADDRESS(1,COLU MN(AA39),4 ,),"1","")
'OR
=SUBSTITUTE(ADDRESS(1,COLU MN(AA39),1 ,),"1","")
=SUBSTITUTE(ADDRESS(1,COLU
'OR
=SUBSTITUTE(ADDRESS(1,COLU
ASKER
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
Thanks
Rob H
ASKER
Actually, got it figured out.
=ADDRESS(MATCH(RIGHT(AA34, 1)*1,$Z$1: $Z$38,0),C OLUMN(),1, 1,RIGHT(CE LL("filena me",$A$1), LEN(CELL(" filename", $A$1))-FIN D("]",CELL ("filename ",$A$1),1) ))&LEFT(AD DRESS(1,CO LUMN(AB34) ,1,),LEN(A DDRESS(1,C OLUMN(AB34 ),1))-1)&M ATCH(RIGHT (AA34,1)+1 ,$Z$1:$Z$3 8)
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
=ADDRESS(MATCH(RIGHT(AA34,
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it is not a circular reference because you do not use the value of the cell but its position
a bit shorter
=ADDRESS(MATCH(RIGHT(AA34, 1)*1,$Z$1: $Z$38,0),C OLUMN(),1, 1,RIGHT(CE LL("filena me",$A$1), LEN(CELL(" filename", $A$1))-FIN D("]",CELL ("filename ",$A$1),1) ))&":"&ADD RESS(MATCH (RIGHT(AA3 4,1)+1,$Z$ 1:$Z$38),C OLUMN(AB34 ),1)
=ADDRESS(MATCH(RIGHT(AA34,
ASKER
Going with this one for Week 1:
=ADDRESS(MATCH(RIGHT(AA33, 1)*1,$Z$1: $Z$38,0),C OLUMN(),1, 1,RIGHT(CE LL("filena me",$A$1), LEN(CELL(" filename", $A$1))-FIN D("]",CELL ("filename ",$A$1),1) ))&":"&SUB STITUTE(AD DRESS(1,CO LUMN(),1,) ,"1","")&M ATCH(RIGHT (AA33,1)+1 ,$Z$1:$Z$3 8,0)-1
and a slight tweak for Week 2:
=ADDRESS(MATCH(RIGHT(AA34, 1)*1,$Z$1: $Z$38,0),C OLUMN(),1, 1,RIGHT(CE LL("filena me",$A$1), LEN(CELL(" filename", $A$1))-FIN D("]",CELL ("filename ",$A$1),1) ))&":"&SUB STITUTE(AD DRESS(1,CO LUMN(),1,) ,"1","")&M ATCH(RIGHT (AA34,1)+1 ,$Z$1:$Z$3 8)
Difference being the non-exact MATCH at the end finding the last occurence of 2 because it can't find 3.
Thanks
Rob H
=ADDRESS(MATCH(RIGHT(AA33,
and a slight tweak for Week 2:
=ADDRESS(MATCH(RIGHT(AA34,
Difference being the non-exact MATCH at the end finding the last occurence of 2 because it can't find 3.
Thanks
Rob H
ASKER
Thank you for your continued support.
pls try for example
=LEFT(ADDRESS(1,COLUMN(AA3
EDIT for your example
you could use LEFT(ADDRESS(1,COLUMN(AA39
Regards