Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Max() Dmax() Looking for MaxIf() Equiv.

I have a table of data in which I need the max based on which field if next
to the cell. There is Sumif(), Countif() etc...which allows me to complete
the math depending on what the first entry in the row is. I can not find the
Max() equivilent though, and It would be useful in many occasions.

Table Ex.

Yellow....2
Red........3
Red........4
Yellow....7
Blue.......1

On the next page i want the cells to look like (seperated by | )

Yellow | Maxif(max_range, variable_range, Variable)
Blue | Maxif(.....variable is A2 this time...)
Red | Maxif(.......................................)

The closest I could find is DMax but in the constraints section you must
have the column header as part of it, which does not let you search the 2nd
and 3rd entry if you copy down with the references. (my list has over a 100
unique entries...)

If anyone could help that would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Max() Dmax() Looking for MaxIf() Equiv.

Hi

=MAX(IF(A1:A9="x",B1:B9,""))

This is an array formula, so you need to press Shift+Ctrl+Enter to enter it,
not Enter.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Derek P" wrote:

I have a table of data in which I need the max based on which field if next
to the cell. There is Sumif(), Countif() etc...which allows me to complete
the math depending on what the first entry in the row is. I can not find the
Max() equivilent though, and It would be useful in many occasions.

Table Ex.

Yellow....2
Red........3
Red........4
Yellow....7
Blue.......1

On the next page i want the cells to look like (seperated by | )

Yellow | Maxif(max_range, variable_range, Variable)
Blue | Maxif(.....variable is A2 this time...)
Red | Maxif(.......................................)

The closest I could find is DMax but in the constraints section you must
have the column header as part of it, which does not let you search the 2nd
and 3rd entry if you copy down with the references. (my list has over a 100
unique entries...)

If anyone could help that would be appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Max() Dmax() Looking for MaxIf() Equiv.

Thanks!

I have always considered myself a proficient Excel person, but I have never
known of an array formula!

Can you just give me some insight on how the formula is processed?

It appears that it looks at the variable (lets choose red since it has a
duplicate in my ex.) and then inserts the corresponding cell into the array,
then looks for the next red and inserts that into the array...

So Array = { }
Find Red, lookup 3 -- Array = { 3 }
Find next Red, lookup 4 -- Array = { 3 , 4 }
Find next Red, None -- Evaluate Max{ 3 , 4 }
4.

I'm guessing the Brackets outside the equation changes the Range of A1:A9
into an Array with those corresponding values? (same for column B?)

Sorry, just never seen this and want to clarify how it works.
Thanks!!

"Shane Devenshire" wrote:

Hi

=MAX(IF(A1:A9="x",B1:B9,""))

This is an array formula, so you need to press Shift+Ctrl+Enter to enter it,
not Enter.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Derek P" wrote:

I have a table of data in which I need the max based on which field if next
to the cell. There is Sumif(), Countif() etc...which allows me to complete
the math depending on what the first entry in the row is. I can not find the
Max() equivilent though, and It would be useful in many occasions.

Table Ex.

Yellow....2
Red........3
Red........4
Yellow....7
Blue.......1

On the next page i want the cells to look like (seperated by | )

Yellow | Maxif(max_range, variable_range, Variable)
Blue | Maxif(.....variable is A2 this time...)
Red | Maxif(.......................................)

The closest I could find is DMax but in the constraints section you must
have the column header as part of it, which does not let you search the 2nd
and 3rd entry if you copy down with the references. (my list has over a 100
unique entries...)

If anyone could help that would be appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 857
Default Max() Dmax() Looking for MaxIf() Equiv.

Hi,

arrays are an extremely useful tool in Excel, but Microsoft's help system
does little to address this topic. I have written a 1200 page book on the
subject but never pursued publishing it.

Considering the formula
=MAX(IF(A1:A9="x",B1:B9,""))

A1:A9="x" returns an array {TRUE,FALSE,...} depending on whether the test
passed or not.
The IF portion then return an array {12,"",16,"","Title","",...)
In other words if the first array returns TRUE at a given postion, then the
IF returns the appropriate item from B1:B9 otherwise it returns "".
Finally, the MAX function evaluates the results. The MAX function might be
looking at =MAX({"";38727;"";"";""}) for example. Normally, the IF would
only return one result so if you do not enter the formula as an array Excel
will use just one of the results of the IF, which may or may not return
anything of value, it may even return an error. But by pressing
Shift+Ctrl+Enter Excel knows to evaluate the IF for all the entries.

Many array formulas can be duplicated using the SUMPRODUCT or on occasion
MMULT functions, but not all. Also there are a number of functions in Excel
which require array entry to work properly, and these are documented in the
help system, for example LINEST, and FREQUENCY.

If this helps, please click the Yes button

Cheers,
Shane Devenshire

"Derek P" wrote in message
...
Thanks!

I have always considered myself a proficient Excel person, but I have
never
known of an array formula!

Can you just give me some insight on how the formula is processed?

It appears that it looks at the variable (lets choose red since it has a
duplicate in my ex.) and then inserts the corresponding cell into the
array,
then looks for the next red and inserts that into the array...

So Array = { }
Find Red, lookup 3 -- Array = { 3 }
Find next Red, lookup 4 -- Array = { 3 , 4 }
Find next Red, None -- Evaluate Max{ 3 , 4 }
4.

I'm guessing the Brackets outside the equation changes the Range of A1:A9
into an Array with those corresponding values? (same for column B?)

Sorry, just never seen this and want to clarify how it works.
Thanks!!

"Shane Devenshire" wrote:

Hi

=MAX(IF(A1:A9="x",B1:B9,""))

This is an array formula, so you need to press Shift+Ctrl+Enter to enter
it,
not Enter.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Derek P" wrote:

I have a table of data in which I need the max based on which field if
next
to the cell. There is Sumif(), Countif() etc...which allows me to
complete
the math depending on what the first entry in the row is. I can not
find the
Max() equivilent though, and It would be useful in many occasions.

Table Ex.

Yellow....2
Red........3
Red........4
Yellow....7
Blue.......1

On the next page i want the cells to look like (seperated by | )

Yellow | Maxif(max_range, variable_range, Variable)
Blue | Maxif(.....variable is A2 this time...)
Red | Maxif(.......................................)

The closest I could find is DMax but in the constraints section you
must
have the column header as part of it, which does not let you search the
2nd
and 3rd entry if you copy down with the references. (my list has over
a 100
unique entries...)

If anyone could help that would be appreciated.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 915
Default Max() Dmax() Looking for MaxIf() Equiv.

Great explanation, Shane.

Have you considered making your book available online? The world could
surely use more information on the subject!

One tiny addition for the OP: There is a tool under Tools | Formula
Auditing | Evaluate Formula that can be very helpful to show how Excel
works through array formulae (or any formula for that matter). To keep
this tool handy, enable the Formula Auditing toolbar.

Shane Devenshire wrote:
Hi,

arrays are an extremely useful tool in Excel, but Microsoft's help
system does little to address this topic. I have written a 1200 page
book on the subject but never pursued publishing it.

Considering the formula
=MAX(IF(A1:A9="x",B1:B9,""))

A1:A9="x" returns an array {TRUE,FALSE,...} depending on whether the
test passed or not.
The IF portion then return an array {12,"",16,"","Title","",...)
In other words if the first array returns TRUE at a given postion, then
the IF returns the appropriate item from B1:B9 otherwise it returns "".
Finally, the MAX function evaluates the results. The MAX function might
be looking at =MAX({"";38727;"";"";""}) for example. Normally, the IF
would only return one result so if you do not enter the formula as an
array Excel will use just one of the results of the IF, which may or may
not return anything of value, it may even return an error. But by
pressing Shift+Ctrl+Enter Excel knows to evaluate the IF for all the
entries.

Many array formulas can be duplicated using the SUMPRODUCT or on
occasion MMULT functions, but not all. Also there are a number of
functions in Excel which require array entry to work properly, and these
are documented in the help system, for example LINEST, and FREQUENCY.

If this helps, please click the Yes button

Cheers,
Shane Devenshire



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Max() Dmax() Looking for MaxIf() Equiv.

Thank you all for your help!

That was a great explination.

And yes, there is very little on using formualas as Arrays. In fact in all
my searching through the help/contents literature I have not once come
accross it.

Thanks again.

"smartin" wrote:

Great explanation, Shane.

Have you considered making your book available online? The world could
surely use more information on the subject!

One tiny addition for the OP: There is a tool under Tools | Formula
Auditing | Evaluate Formula that can be very helpful to show how Excel
works through array formulae (or any formula for that matter). To keep
this tool handy, enable the Formula Auditing toolbar.

Shane Devenshire wrote:
Hi,

arrays are an extremely useful tool in Excel, but Microsoft's help
system does little to address this topic. I have written a 1200 page
book on the subject but never pursued publishing it.

Considering the formula
=MAX(IF(A1:A9="x",B1:B9,""))

A1:A9="x" returns an array {TRUE,FALSE,...} depending on whether the
test passed or not.
The IF portion then return an array {12,"",16,"","Title","",...)
In other words if the first array returns TRUE at a given postion, then
the IF returns the appropriate item from B1:B9 otherwise it returns "".
Finally, the MAX function evaluates the results. The MAX function might
be looking at =MAX({"";38727;"";"";""}) for example. Normally, the IF
would only return one result so if you do not enter the formula as an
array Excel will use just one of the results of the IF, which may or may
not return anything of value, it may even return an error. But by
pressing Shift+Ctrl+Enter Excel knows to evaluate the IF for all the
entries.

Many array formulas can be duplicated using the SUMPRODUCT or on
occasion MMULT functions, but not all. Also there are a number of
functions in Excel which require array entry to work properly, and these
are documented in the help system, for example LINEST, and FREQUENCY.

If this helps, please click the Yes button

Cheers,
Shane Devenshire


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
Countifs equiv in 2003 Dan Excel Discussion (Misc queries) 6 August 26th 09 08:30 AM
DMAX taken to the max Gus[_2_] Excel Worksheet Functions 3 May 14th 07 02:01 PM
How do I DMAX only part of a column? Stu Leslie Excel Worksheet Functions 2 September 7th 06 12:19 PM
DMAX wrong calculation AlexKoL Excel Worksheet Functions 3 August 25th 06 06:43 PM
DMAX criteria joeeng Excel Worksheet Functions 2 August 9th 05 02:09 PM


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

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

About Us

"It's about Microsoft Excel"