Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How get Excel 2007 to return highest column

I have an array of data. I need a formula that will return the column number
of the highest column with content.


For example:
A B C D E F
1 3 2 3
2 3 4
3 2 4 5 1
4 2 3

Where the answers should be D, E, F, and B, respectively.

Any suggestions?
Thanks
Justin

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default How get Excel 2007 to return highest column

=LOOKUP(10^10,1:1)


"virtualjustin" wrote:

I have an array of data. I need a formula that will return the column number
of the highest column with content.


For example:
A B C D E F
1 3 2 3
2 3 4
3 2 4 5 1
4 2 3

Where the answers should be D, E, F, and B, respectively.

Any suggestions?
Thanks
Justin

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How get Excel 2007 to return highest column

Where the answers should be D, E, F, and B, respectively.

Huh?

I think a better explanation is needed (at least, for me!).

--
Biff
Microsoft Excel MVP


"virtualjustin" wrote in message
...
I have an array of data. I need a formula that will return the column
number
of the highest column with content.


For example:
A B C D E F
1 3 2 3
2 3 4
3 2 4 5 1
4 2 3

Where the answers should be D, E, F, and B, respectively.

Any suggestions?
Thanks
Justin



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How get Excel 2007 to return highest column

Assume source data as posted is in Sheet1

In Sheet2,
Put this in any starting cell, say in B2, then array-enter the formula by
pressing CTRL+SHIFT+ENTER, instead of just pressing ENTER:
=IF(COUNT(Sheet1!1:1),MATCH(MAX(ISNUMBER(Sheet1!1: 1)*COLUMN(1:1)),(ISNUMBER(Sheet1!1:1))*(COLUMN(1:1 )),0),"")
B2 returns the required col number of row1 in Sheet1, ie: 4. Copy B2 down to
return correspondingly for the other data rows in Sheet1. You'd get the
stated results: 4,5,6,2 in B2:B5
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"virtualjustin" wrote:
I have an array of data. I need a formula that will return the column number
of the highest column with content.


For example:
A B C D E F
1 3 2 3
2 3 4
3 2 4 5 1
4 2 3

Where the answers should be D, E, F, and B, respectively.

Any suggestions?
Thanks
Justin

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default How get Excel 2007 to return highest column

On Sun, 17 Feb 2008 12:33:02 -0800, virtualjustin
wrote:

I have an array of data. I need a formula that will return the column number
of the highest column with content.


For example:
A B C D E F
1 3 2 3
2 3 4
3 2 4 5 1
4 2 3

Where the answers should be D, E, F, and B, respectively.



Hmmm. The last I checked, "D" was not a number <g.

If you want the column NUMBER, then:


=LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256")))
for Row 1

If you copy/fill down, the row parameter will adjust for subsequent rows.

and so forth.

If you want the column letter, then try:

=LEFT(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4),
LEN(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4))-1)

And if you want the contents of that cell, you can try:

=LOOKUP(2,1/(LEN(1:1)0),1:1)


--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default How get Excel 2007 to return highest column

Ron Rosenfeld wrote...
....
If you want the column NUMBER, then:

=LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256")))
for Row 1

....

OP's subject line says Excel 2007, and Excel 2007 has more than 256
columns. Also an unnecessary use of the volatile INDIRECT. Better to
rewrite this as

=LOOKUP(2,1/(LEN(1:1)0),COLUMN(1:1))

or

=LOOKUP(2,1/(1:1<""),COLUMN(1:1))

If you want the column letter, then try:

=LEFT(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4),
LEN(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4))-1)

....

Or

=SUBSTITUTE(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),COLUMN(1:1)),4),1,"")
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default How get Excel 2007 to return highest column

On Sun, 17 Feb 2008 23:24:16 -0800 (PST), Harlan Grove
wrote:

Ron Rosenfeld wrote...
...
If you want the column NUMBER, then:

=LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256")))
for Row 1

...

OP's subject line says Excel 2007, and Excel 2007 has more than 256
columns. Also an unnecessary use of the volatile INDIRECT. Better to
rewrite this as

=LOOKUP(2,1/(LEN(1:1)0),COLUMN(1:1))

or

=LOOKUP(2,1/(1:1<""),COLUMN(1:1))

If you want the column letter, then try:

=LEFT(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4),
LEN(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),ROW(INDIRECT("1:256"))),4))-1)

...

Or

=SUBSTITUTE(ADDRESS(1,LOOKUP(2,1/(LEN(1:1)0),COLUMN(1:1)),4),1,"")



Good suggestions.

I never realized, nor tested to see, that COLUMN (and ROW also, for that
matter) would return an array.

So far as 2007, I thought about that when writing my more complex formula to
parse out the column letter, but not when generating the column number itself.
One of these days I'll have to get 2007.
--ron
Reply
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
return rating of which number is highest and descending in column andemor Excel Worksheet Functions 2 May 21st 07 02:52 PM
2 rows, highest No in row 1, then highest number in row 2 relating to that column, possible duplicates John Excel Worksheet Functions 3 August 11th 06 04:34 AM
Summing & return highest value PSU35 New Users to Excel 2 May 31st 06 07:39 PM
Excel:a column of numbers,I want the highest shown automatically? Betternotpeak Excel Discussion (Misc queries) 2 January 5th 06 10:39 AM
How do I return the highest value in a range of cells pjs83 Excel Worksheet Functions 5 July 6th 05 09:25 PM


All times are GMT +1. The time now is 04:04 PM.

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"