+ Reply to Thread
Results 1 to 14 of 14

Need a formula for the column letter to use in INDIRECT

  1. #1
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Need a formula for the column letter to use in INDIRECT

    Hi,
    I have a formula that looks at a monthly series of returns and always calculates a year-to-date return. I want to copy the formula in F28 across columns so I need the letter "F" to change:
    =PRODUCT(1+(INDIRECT("F"&MATCH($E$34,$C$1:$C$25,0)&":F"&MATCH($E$34,$C$1:$C$25,0)+MONTH(EOMONTH(TODAY(),-1)))))-1

    I am able to substitute "F" for a cell reference in F35 which has the formula =CHAR(COLUMN()+64) but when I substitute "F" with the formula itself it doesn't work. I also need to substitute ":F" in the long formula.

    Any suggestions would be appreciated,

    Phillycheese
    Attached Files Attached Files
    Last edited by Phillycheese5; 10-14-2021 at 09:30 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Re: Need a formula for the column letter to use in INDIRECT

    Hi There!
    Thank you for the formula which works great for columns A to Z, but will show "A" for the AA to AZ columns. Apologies that I didn't mention it, but the file I plan to use it is is quite large and has many columns.

    Sincerely,
    Phillycheese

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    Not pretty, but try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    If, in Name Manager, you create a Named Formula:
    vAddr=
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You can then shorten your formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Re: Need a formula for the column letter to use in INDIRECT

    Thanks TMS! I can get the named formula to work by itself but not when I pop it in the formula. I'm going to dig in because it may be something on my side. I appreciate the help and I'll mark it solved when I resolve the issue.
    Much appreciated,
    Phillycheese

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    Can't you just copy it?

  8. #8
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Re: Need a formula for the column letter to use in INDIRECT

    Hi TMS, for some reason the SUBSTITUTE just doesn't work (I get #VALUE) when I copy/paste it into the formula, or when I take the entire formula that you noted. I created the named range exactly as you had it and both that and the SUBSTITUTE works fine in a cell by itself.

    In the updated file I created a tab called COPY and you can see that if I use vADDr in the long formula it doesn't work. But if I put the =vADDr as a formula in a separate cell and then reference that cell in the long formula, it does work. Any ideas on why I can't use them interchangeably?

    Thanks,
    Phillycheese

  9. #9
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Need a formula for the column letter to use in INDIRECT

    please try

    SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")

    in your formula, or test in any blank cell.

    Regards.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    See these examples
    Attached Files Attached Files

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    @menem: wish I’d thought of that. Much shorter and simpler. And just the 1 to eliminate

  12. #12
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Need a formula for the column letter to use in INDIRECT

    Add T

    =PRODUCT(1+(INDIRECT(T(vADDr&MATCH($E$34,$C$1:$C$25,0)&":"&vADDr&MATCH($E$34,$C$1:$C$25,0)+MONTH(EOMONTH(TODAY(),-1))))))-1

    or R1C1
    =PRODUCT(1+(INDIRECT("R"&MATCH($E$34,$C$1:$C$25,0)&"C:R"&MATCH($E$34,$C$1:$C$25,0)+MONTH(EOMONTH(TODAY(),-1))&"C",)))-1

    or non-volatile

    =PRODUCT(1+INDEX(F$5:F$25,MATCH(E34,$C$5:$C$25,)):INDEX(F$5:F$25,MATCH(TODAY(),$C$5:$C$25)))-1
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Re: Need a formula for the column letter to use in INDIRECT

    Hi TMS/menem/Bo_Ry, thank you all for the help with this. I thought it might be the version of Excel I have (2007) but I sent it to my work also where there is version 2016. In both cases I'm experiencing the same thing. When I open the TMS file, I get #VALUE for the examples you have in F57 and F60--but F58 and F59 display the correct result. In Bo_Ry's file the "T" formula shows #VALUE but the non-volatile formula does work in so I will use that or a helper row with either the named range or one of the SUBSTITUTE formulas which seems to do the trick.
    Many thanks for the help and different solutions!
    Phillycheese

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Need a formula for the column letter to use in INDIRECT

    You're welcome. Thanks for the rep.


    Please update your profile. That makes a difference in terms of if/how solutions work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-04-2021, 11:08 AM
  2. Replies: 6
    Last Post: 03-30-2016, 04:28 PM
  3. [SOLVED] Use indirect to replace the letter of the column
    By YasserKhalil in forum Excel General
    Replies: 24
    Last Post: 06-28-2015, 11:59 AM
  4. Varying column letter in a formula
    By SarBreen in forum Excel General
    Replies: 1
    Last Post: 06-08-2011, 01:00 PM
  5. Replies: 6
    Last Post: 10-13-2005, 05:05 AM
  6. [SOLVED] How to replace column letter in refferences with a function using the old column letter?
    By Dmitry Kopnichev in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-13-2005, 05:05 AM
  7. Replies: 2
    Last Post: 05-09-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1