+ Reply to Thread
Results 1 to 7 of 7

How to use INDEX and a column number or reference

  1. #1
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    How to use INDEX and a column number or reference

    Hi,

    Is there a way to substitute a column letter in a formula, say the letter "C" for column C, with a reference to a cell containing that column letter?

    Right now, I have the following formula:

    =C17:INDEX(C:C,COUNTA(C:C))

    I would like to link those C's to a cell containing either a number or a letter.

    What I am trying to do is create a dynamic range with a column that may move left or right. Sometimes the dynamic range will be column C, sometimes another column. I am also trying to NOT use volatile function OFFSET which would work but slow things down.


    Thanks,

    Lawrence

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: How to use INDEX and a column number or reference

    Like this
    =INDEX(INDIRECT(A1&":"&A1),COUNTA(INDIRECT(A1&":"&A1)))
    Where A1 contains "C" letter...
    HTH xD
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to use INDEX and a column number or reference

    Quote Originally Posted by skysurfer View Post
    I would like to link those C's to a cell containing either a number or a letter....

    ...What I am trying to do is create a dynamic range with a column that may move left or right. Sometimes the dynamic range will be column C, sometimes another column. I am also trying to NOT use volatile function OFFSET which would work but slow things down.
    In which case use a Number.

    =INDEX($17:$17,yournumber):INDEX($1:$65536,COUNTA(INDEX($1:$65536,0,yournumber),yournumber)


    (User of letter would necessitate use of INDIRECT which, like OFFSET, is Volatile)

  4. #4
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    Re: How to use INDEX and a column number or reference

    DonkeyOte,

    Thanks! Will using $65536 in the formula create a problem going from Excel 2003 to 2007 or 2010?

    Lawrence

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to use INDEX and a column number or reference

    If you use more then 65536 then yes.

  6. #6
    Forum Contributor
    Join Date
    05-24-2006
    Location
    Los Angeles
    MS-Off Ver
    2019
    Posts
    328

    Re: How to use INDEX and a column number or reference

    Does that mean the $65536 can not be replaced by a cell reference containing a number or the COUNTA function?

    Lawrence

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: How to use INDEX and a column number or reference

    Using more than 65536 as a row reference will only be a problem in XL2003, because that version can only handle 65536 rows. In 2007 and later, a number greater than 65536 is fine, if you use the native xlsx format and not the 2003 compatible xls file format.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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