PC Review


Reply
Thread Tools Rate Thread

conditional MAX associated row data

 
 
toolbox
Guest
Posts: n/a
 
      26th Mar 2007
I am struggling with the following MS-Excel formula. In the data that
follows I want to retrieve the NAME of the person who achieved the
highest test SCORE where the DIFFICULTY rating exceeded 60. From the
data below, I would expect to receive the name "Nate" from the 5th
row.

NAME DIFFICULTY SCORE
Nate 55 78
Sara 62 77
Sara 58 79
Nate 64 79
Sara 59 84

I've discovered that I can retrieve the relevant score (79) with the
following formula, but the same does not work for retreiving the text
value in column A. When I convert the formula to return column A
instead of C, I get the value "0" instead of "Nate."
=MAX(IF($B$2:$B$9999>60,$C$2:$C$9999)) /* enter formula then press
shift_control_enter */

Thanks for any help.

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      26th Mar 2007
One way (array-entered:CTRL-SHIFT-ENTER or CMD-RETURN):

=INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C6),(B2:B6>=60)*C2:C6,FALSE))

In article <(E-Mail Removed)>,
"toolbox" <(E-Mail Removed)> wrote:

> I am struggling with the following MS-Excel formula. In the data that
> follows I want to retrieve the NAME of the person who achieved the
> highest test SCORE where the DIFFICULTY rating exceeded 60. From the
> data below, I would expect to receive the name "Nate" from the 5th
> row.
>
> NAME DIFFICULTY SCORE
> Nate 55 78
> Sara 62 77
> Sara 58 79
> Nate 64 79
> Sara 59 84
>
> I've discovered that I can retrieve the relevant score (79) with the
> following formula, but the same does not work for retreiving the text
> value in column A. When I convert the formula to return column A
> instead of C, I get the value "0" instead of "Nate."
> =MAX(IF($B$2:$B$9999>60,$C$2:$C$9999)) /* enter formula then press
> shift_control_enter */
>
> Thanks for any help.

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      26th Mar 2007
Correction, should be > rather than >= in both places

In article <jemcgimpsey-(E-Mail Removed)>,
JE McGimpsey <(E-Mail Removed)> wrote:

> One way (array-entered:CTRL-SHIFT-ENTER or CMD-RETURN):
>
> =INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C6),(B2:B6>=60)*C2:C6,FALSE))
>

 
Reply With Quote
 
toolbox
Guest
Posts: n/a
 
      27th Mar 2007

Thanks so much for your reply JE. The formula you provided works
great for me, but I have encountered one additional problem. The
formula contains the range "C2:C6", which is the current number of
rows in my table. I expect to add new rows to my table frequently.
However, if I alter the forumla to include rows that do not exist yet,
then the formula produces an error. Because the number of rows is
hardcoded in this formula, I would need to update the formula each
time I add a new row of data to the table. Can you think of a way to
either make the formula calculate the number of data rows to look at,
or to alter the formula so that it does not produce an error if it
encounters a blank row?

/* Work great assuming my last data is in row 6 */
=INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C6),(B2:B6>=60)*C2:C6,FALSE))

/* Produces an error when no data exists in rows 7 through 9999 */
=INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C9999),
(B2:B6>=60)*C2:C9999,FALSE))



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      27th Mar 2007
All the arrays should have the same number of rows:

=INDEX(A2:A9999, MATCH(MAX((B2:B9999>=60)*C2:C9999),
(B2:B9999>=60)*C2:C9999, FALSE))

In article <(E-Mail Removed)>,
"toolbox" <(E-Mail Removed)> wrote:

> Thanks so much for your reply JE. The formula you provided works
> great for me, but I have encountered one additional problem. The
> formula contains the range "C2:C6", which is the current number of
> rows in my table. I expect to add new rows to my table frequently.
> However, if I alter the forumla to include rows that do not exist yet,
> then the formula produces an error. Because the number of rows is
> hardcoded in this formula, I would need to update the formula each
> time I add a new row of data to the table. Can you think of a way to
> either make the formula calculate the number of data rows to look at,
> or to alter the formula so that it does not produce an error if it
> encounters a blank row?
>
> /* Work great assuming my last data is in row 6 */
> =INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C6),(B2:B6>=60)*C2:C6,FALSE))
>
> /* Produces an error when no data exists in rows 7 through 9999 */
> =INDEX(A2:A6,MATCH(MAX((B2:B6>=60)*C2:C9999),
> (B2:B6>=60)*C2:C9999,FALSE))

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with conditional data Alok Microsoft Excel Worksheet Functions 1 19th Sep 2008 01:00 PM
Conditional Formatting based on data in adjacent cell & restrict save without required data bjohnson Microsoft Excel Programming 1 28th Aug 2007 10:27 PM
Conditional data =?Utf-8?B?VmFsZXJpYW4=?= Microsoft Excel Worksheet Functions 2 27th Mar 2006 12:33 AM
Re: Conditional data daddylonglegs Microsoft Excel Worksheet Functions 0 26th Mar 2006 11:50 PM
Conditional Formatting that will display conditional data =?Utf-8?B?QnJhaW5GYXJ0?= Microsoft Excel Worksheet Functions 1 13th Sep 2005 05:45 PM


Features
 

Advertising
 

Newsgroups
 


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