Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
automandc
 
Posts: n/a
Default Retrieving a Reference

Is there a way to retrieve the reference to a Statistical/Math function
result, rather than the actual result?

I have a large table (R1150 X C50) with numeric values in each cell. I want
to put all of the data into numerical order, but retain the name of the
column each data point came from.

Let's say the table is at A1:Z1000. I can use the LARGE function to choose
the nth largest value with LARGE($A$1:$Z$1000,n). Make "n" a reference to a
series in an adjoining column, and it is easy to create a one-dimensional
list of the top n values. However, there is no way to associate each value
back to the table for the purpose of finding the column it came from.
Neither VLOOKUP nor HLOOKUP will work, since the value could come from any
column or row in the 2D table.

It seems that if LARGE goes out there and evaluates all of the datapoints to
determine the nth largest, it ought to be able to tell me where it got that
datapoint from.

So, is there a way to extract the reference rather than the result from a
function like "LARGE"? (this would also apply to any function that singles
out a specific value from an array, such as "MIN", "MAX"; but not calculation
functions like "AVERAGE").
  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

Assume you have a table A1:E10 and you want the 2nd largest value

=LARGE($A$1:$E$10,2)

this formula will return the cell reference that holds the 2nd largest value


=CELL("address",INDEX($A$1:$E$10,MIN(IF($A$1:$E$10 =LARGE($A$1:$E$10,2),ROW($A$1:$E$10))),MIN(IF($A$1 :$E$10=LARGE($A$1:$E$10,2),COLUMN($A$1:$E$10)))))

it needs to be entered with

ctrl + shift & enter

note that if there are multiple 2nd largest values it will return the first
occurrence counted from
A1

also note that if you use for instance a table like B3:F20 then the index
part should be

INDEX(A1:F20 or else you have to offset the rows/columns since ROW and
COLUMN always will start from first row/column

--
Regards,

Peo Sjoblom


"automandc" wrote in message
...
Is there a way to retrieve the reference to a Statistical/Math function
result, rather than the actual result?

I have a large table (R1150 X C50) with numeric values in each cell. I
want
to put all of the data into numerical order, but retain the name of the
column each data point came from.

Let's say the table is at A1:Z1000. I can use the LARGE function to
choose
the nth largest value with LARGE($A$1:$Z$1000,n). Make "n" a reference to
a
series in an adjoining column, and it is easy to create a one-dimensional
list of the top n values. However, there is no way to associate each
value
back to the table for the purpose of finding the column it came from.
Neither VLOOKUP nor HLOOKUP will work, since the value could come from any
column or row in the 2D table.

It seems that if LARGE goes out there and evaluates all of the datapoints
to
determine the nth largest, it ought to be able to tell me where it got
that
datapoint from.

So, is there a way to extract the reference rather than the result from a
function like "LARGE"? (this would also apply to any function that
singles
out a specific value from an array, such as "MIN", "MAX"; but not
calculation
functions like "AVERAGE").


  #3   Report Post  
David McRitchie
 
Posts: n/a
Default

See use of MATCH Worksheet Function in
http://www.mvps.org/dmcritchie/excel/vlookup.htm#match
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"automandc" wrote in message ...
Is there a way to retrieve the reference to a Statistical/Math function
result, rather than the actual result?

I have a large table (R1150 X C50) with numeric values in each cell. I want
to put all of the data into numerical order, but retain the name of the
column each data point came from.

Let's say the table is at A1:Z1000. I can use the LARGE function to choose
the nth largest value with LARGE($A$1:$Z$1000,n). Make "n" a reference to a
series in an adjoining column, and it is easy to create a one-dimensional
list of the top n values. However, there is no way to associate each value
back to the table for the purpose of finding the column it came from.
Neither VLOOKUP nor HLOOKUP will work, since the value could come from any
column or row in the 2D table.

It seems that if LARGE goes out there and evaluates all of the datapoints to
determine the nth largest, it ought to be able to tell me where it got that
datapoint from.

So, is there a way to extract the reference rather than the result from a
function like "LARGE"? (this would also apply to any function that singles
out a specific value from an array, such as "MIN", "MAX"; but not calculation
functions like "AVERAGE").



  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

"automandc" wrote...
....
I have a large table (R1150 X C50) with numeric values in each cell. I

want
to put all of the data into numerical order, but retain the name of the
column each data point came from.

....

50 * 1150 = 57500, so not a problem fitting all observations into separate
rows in one worksheet.

Simplest way I can think of is naming your original data range Data, then
extracting it into 2 colums (original column letter in first column, data
value in sedond column), coverting formulas to values, then sorting the
result.

If the top-left cell of the extract range were X5, enter the following
formulas.

X5:
=SUBSTITUTE(ADDRESS(1,1+INT((ROW()-ROW($X$5))/ROWS(Data)),4),"1","")

Y5:
=INDEX(Data,1+MOD(ROW()-ROW($X$5),ROWS(Data)),
1+INT((ROW()-ROW($X$5))/ROWS(Data)))

Fill X5:Y5 down into X6:Y57504. Select X5:Y57504, Edit Copy, Edit Paste
Special as values, Data Sort on column Y in descending order. You should
have the data values in col Y sorted in descending order and their original
column letters in the same row in col X.


  #5   Report Post  
automandc
 
Posts: n/a
Default

Thanks to all who responded so far. Each of your proposed solutions offers
promise, and I will use them to build a final solution.

Peo's solution is the most on-point (actually finding the address of the
resulting cell), but it is so bulky that I fear it will seriously choke in a
sheet with 50,000+ instances of the formula. He also points up the problem
with using "LARGE": failure to properly handle identical values.

The info on David's page is great, and will help me solve a lot of problems
I run across when tinkering in Excel.

Harlan's solution is perhaps less elegant (no offense), but it is what I am
currently doing -- only I've been doing it manually with cut-and-paste to put
the data into one column. (First I create a second set of columns that
contain a string of the data point cat'ed with the header description, then
seperate them back into two separate columns after combining into a single
column list). Harlan's method will allow me to programatically create the
unified list I am currently doing manually and skip the step of
double-conversion. Of course, it has the drawback of quickly running up
against the 65K row limit for tables that get big.

It would ultimately be nice if you could do something like this:

=Large&(data_range,n)

and get a pointer to the result (e.g. a reference), instead of having word
actually resolve the result. This would be kind of like a reverse-INDIRECT
function.

Sometimes I really wish there was a way to do loops directly in the
worksheets (like a FOR..NEXT loop), and have it fill in a range with the
results.

Anyway, thanks again everyone -- the MSDN forums always come through for me.

Tobias

"automandc" wrote:

Is there a way to retrieve the reference to a Statistical/Math function
result, rather than the actual result?

I have a large table (R1150 X C50) with numeric values in each cell. I want
to put all of the data into numerical order, but retain the name of the
column each data point came from.

Let's say the table is at A1:Z1000. I can use the LARGE function to choose
the nth largest value with LARGE($A$1:$Z$1000,n). Make "n" a reference to a
series in an adjoining column, and it is easy to create a one-dimensional
list of the top n values. However, there is no way to associate each value
back to the table for the purpose of finding the column it came from.
Neither VLOOKUP nor HLOOKUP will work, since the value could come from any
column or row in the 2D table.

It seems that if LARGE goes out there and evaluates all of the datapoints to
determine the nth largest, it ought to be able to tell me where it got that
datapoint from.

So, is there a way to extract the reference rather than the result from a
function like "LARGE"? (this would also apply to any function that singles
out a specific value from an array, such as "MIN", "MAX"; but not calculation
functions like "AVERAGE").



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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Absolute Worksheet reference number Tony M Excel Discussion (Misc queries) 4 March 21st 05 06:10 PM
how to create a variable column in cell reference Sampson Excel Worksheet Functions 3 February 21st 05 10:13 PM
Cell Reference Math Ralph Howarth Excel Worksheet Functions 0 January 26th 05 06:27 PM
How do I reference multiple rows Awetronics Excel Worksheet Functions 1 November 4th 04 12:37 AM


All times are GMT +1. The time now is 03:40 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"