LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default =INDEX($B$2:$P$2,COLUMNS(B$2:$P$2))


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Index Match for 2 columns and one Row [email protected] Excel Worksheet Functions 11 September 28th 06 07:50 PM
INDEX function multiple columns & rows jasebeds Excel Worksheet Functions 2 August 27th 06 05:41 PM
INDEX() columns first spxer Excel Worksheet Functions 9 August 6th 06 12:22 AM
Index Match Two columns Find Last Bottom henryriver1 Excel Worksheet Functions 4 May 26th 06 04:49 PM
Index/Match from multiple columns hgopp99 Excel Worksheet Functions 5 January 21st 06 06:13 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"