Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Usually, the 2nd argument of Index() represents the row, and the 3rd designates the column. However, if using a 1 dimension array, the 2nd argument pertains to *that* single dimension, be it row or column. Indexing the range B2:P2, the 2nd argument designates which *column* to reference. In this formula, the Columns() function acts *strictly* as a number generator. Columns() with an *s*, returns the number of columns in an array. =Columns(A:A) equals 1 =Columns (A:Z) equals 26 Drag "=Columns(A:A)" along any row, across columns, and it *still* returns "1", even though the formula itself increments: =Columns(A:A) =Columns(B:B) =Columns(C:C) ... etc. However, anchor one of the references with absolute addressing, and you'll increment the relative column address (decrement if dragging left), thus modifying the numerical return: =Columns($A:A) returns 1, =Columns($A:B) returns 2,=Columns($A:C) returns 3, .... etc. =Columns(A:$Z) returns 26, =Columns(B:$Z) returns 25, =Columns(C:$Z) returns 24, ... etc. So, the above formula could just as well have been written: =INDEX($B$2:$P$2,COLUMNS(B:$P)) OR =INDEX($B$2:$P$2,COLUMNS(A:$O)) OR even =INDEX($B$2:$P$2,COLUMNS(L:$Z)) -- HTH, RD ================================================== === Please keep all correspondence within the Group, so all may benefit! ================================================== === "Dave F" wrote in message ... Can someone explain to me why the above formula will reverse the order of the contents of columns B:P? This is my understanding: the COLUMNS(...) portion identifies the column number in the range B2:P2, and the INDEX(....) portion returns the contents of the cell corresponding to that column number in the range B2:P2. Sound correct? Thanks, Dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Index Match for 2 columns and one Row | Excel Worksheet Functions | |||
INDEX function multiple columns & rows | Excel Worksheet Functions | |||
INDEX() columns first | Excel Worksheet Functions | |||
Index Match Two columns Find Last Bottom | Excel Worksheet Functions | |||
Index/Match from multiple columns | Excel Worksheet Functions |