+ Reply to Thread
Results 1 to 14 of 14

What does (COLUMNS($A:A) mean?

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    60

    What does (COLUMNS($A:A) mean?

    I have this formula in row K10 to render values in column G27 to G37, just wondering what does the function COLUMNS($A:A) mean?
    =IF($D$14="Yes",INDEX(Sheet2!$G$27:$G$37,COLUMNS($A:A)),0

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: What does (COLUMNS($A:A) mean?

    COLUMNS($A:A) =1
    changes to
    COLUMNS($A:B) =2
    then
    COLUMNS($A:C) =3

    and so on as the formula is filled across
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    10-09-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: What does (COLUMNS($A:A) mean?

    thanks martin but why do i need numbers 1,2,3,etc. in the formula?

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: What does (COLUMNS($A:A) mean?

    INDEX(Sheet2!$G$27:$G$37,1)=g27
    INDEX(Sheet2!$G$27:$G$37,2)=g28
    INDEX(Sheet2!$G$27:$G$37,3) =g29 and so on

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: What does (COLUMNS($A:A) mean?

    Your formula contains INDEX, operating on a range of Sheet2!$G$27:$G$37. The syntax for that function is INDEX(range, row, column), although column is redundant here because you range is only one column wide. So in the first instance, INDEX(Sheet2!$G$27:$G$37,COLUMNS($A:A)) will return the first element of that range, i.e. G27, in the second instance INDEX(Sheet2!$G$27:$G$37,COLUMNS($A:B)) will return the second element, i.e. G28.

    So, as the formula is copied across, the COLUMNS() part will change, and so the INDEX part will return values from successive rows.

    Hope this helps.

    Pete

    EDIT: Oops, Martin hadn't replied when I started my explanation.
    Last edited by Pete_UK; 11-03-2012 at 02:44 PM.

  6. #6
    Registered User
    Join Date
    10-09-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: What does (COLUMNS($A:A) mean?

    Thanks Pete and Martin

    please correct me if i misunderstood your explaination:

    so in the function COLUMNS ($A:A) the first A refers to the first column in the array and the second A refers to the first row in the array; likewise($A:B) indicates first (and only) column in array and B second row in array and so on?

    Thanks

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: What does (COLUMNS($A:A) mean?

    No. The function COLUMNS() returns the number of columns there are in the range supplied to it. So, COLUMNS($A:A) returns the number 1, whereas COLUMNS($A:B) returns the number 2 - rows have nothing to do with it, so COLUMNS($A1:C$10) for example would return the number 3. The $ symbol in front of the A prevents it from changing if it is copied across, so it is always "anchored" to that column as the start of the range. The other parameter, A without the $ symbol, is free to change as it is copied across, so it becomes $A:B, $A:C, $A:D etc in successive columns, thus returning 2, 3, 4 and so on. It is a quick and easy way of incrementing a number as a formula is copied across, and in conjunction with INDEX it will return the 1st, 2nd, 3rd, 4th etc element of the range which is being indexed.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    10-09-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: What does (COLUMNS($A:A) mean?

    I see! Thanks Pete. How will the formula change if the range is in a row and i want to return the values in a column?

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: What does (COLUMNS($A:A) mean?

    The opposite of column() is row().

    I don't know if this is an answer to your question.

    Otherwise:

    1) Wait for an reaction of other forummembers.

    or

    2) Post an example of your Excel file, without confidentional information, AND the desired result.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  10. #10
    Registered User
    Join Date
    10-09-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    60

    Re: What does (COLUMNS($A:A) mean?

    thanks oeldere, attached is the sheet: What should go in red cell I22?
    Attached Files Attached Files

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: What does (COLUMNS($A:A) mean?

    Put this formula in I22:

    =INDEX($D$9:$M$9,ROWS($1:1))

    then copy it down.

    NOTE that you do not need to commit with with CSE - it is not an array formula. The same applies to the formula you have in D9.

    Hope this helps.

    Pete

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: What does (COLUMNS($A:A) mean?

    =index($p$8:$p$17,rows($a$1:a1))

  13. #13
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: What does (COLUMNS($A:A) mean?

    See the attached file.

    I see PeteUk and Martindwilson have already give you an anser.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: What does (COLUMNS($A:A) mean?

    @rentb23

    It would be nice to the ones who respond on your question,

    if you respond (feed back)

    (and after that marking the question as solved),

    are the given solution usefull?

+ 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