Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
multiple conditions formula
 
Posts: n/a
Default How do I add multiple conditions to a formula?

Hi, I've tried using COUNT, SUM, SUMIF, COUNTIF, SUMPRODUCT, and nesting IF
functions, but I can't seem to get this formula to work.
control 0.122
GlcNAc 0.255
GlcNAc 0.478
control 0.377
control 0.301

I want to count the number of values for "control" between 0.3 and 0.4, and
have this count represented in a cell on a separate worksheet. Thanks a lot
for all your help.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jerry W. Lewis
 
Posts: n/a
Default How do I add multiple conditions to a formula?

=SUMPRODUCT((A1:A5="control")*(B1:B5=0.3)*(B1:B5< =0.4))

Jerry

"multiple conditions formula" wrote:

Hi, I've tried using COUNT, SUM, SUMIF, COUNTIF, SUMPRODUCT, and nesting IF
functions, but I can't seem to get this formula to work.
control 0.122
GlcNAc 0.255
GlcNAc 0.478
control 0.377
control 0.301

I want to count the number of values for "control" between 0.3 and 0.4, and
have this count represented in a cell on a separate worksheet. Thanks a lot
for all your help.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
multiple conditions formula
 
Posts: n/a
Default How do I add multiple conditions to a formula?

Thanks Jerry for the quick reply. It's giving me the right answer now,
though it's not really a sum of the products of those values, is it? I mean,
what's written looks like it should give the sum of 0.377 and 0.301 (0.678),
and not the value 2, if I understood the help on that function in Excel,
which I guess I didn't.

"Jerry W. Lewis" wrote:

=SUMPRODUCT((A1:A5="control")*(B1:B5=0.3)*(B1:B5< =0.4))

Jerry

"multiple conditions formula" wrote:

Hi, I've tried using COUNT, SUM, SUMIF, COUNTIF, SUMPRODUCT, and nesting IF
functions, but I can't seem to get this formula to work.
control 0.122
GlcNAc 0.255
GlcNAc 0.478
control 0.377
control 0.301

I want to count the number of values for "control" between 0.3 and 0.4, and
have this count represented in a cell on a separate worksheet. Thanks a lot
for all your help.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jerry W. Lewis
 
Posts: n/a
Default How do I add multiple conditions to a formula?

This is an undocumented, but quite common use of SUMPRODUCT

(A1:A5="control") etc. each return an array of 5 booleans (True or False).

"*" is used instead of "," to multiply the arrays together because "*" in
the process converts True-1 and False-0, so you end up with an array of 5
ones (if all 3 conditions are satisfied) or zeros (otherwise). Summing that
array or zeros and ones is equivalent to counting the number of cases where
all 3 conditions are satisfied.

SUMPRODUCT was used instead of SUM because SUM would need to have been array
entered.

In boolean arithmetic, "*" functions like "AND" and "+" functions like "OR";
you can use them together with parentheses (to control order of evaluation)
to produce quite complicated conditions.

Jerry

"multiple conditions formula" wrote:

Thanks Jerry for the quick reply. It's giving me the right answer now,
though it's not really a sum of the products of those values, is it? I mean,
what's written looks like it should give the sum of 0.377 and 0.301 (0.678),
and not the value 2, if I understood the help on that function in Excel,
which I guess I didn't.

"Jerry W. Lewis" wrote:

=SUMPRODUCT((A1:A5="control")*(B1:B5=0.3)*(B1:B5< =0.4))

Jerry

"multiple conditions formula" wrote:

Hi, I've tried using COUNT, SUM, SUMIF, COUNTIF, SUMPRODUCT, and nesting IF
functions, but I can't seem to get this formula to work.
control 0.122
GlcNAc 0.255
GlcNAc 0.478
control 0.377
control 0.301

I want to count the number of values for "control" between 0.3 and 0.4, and
have this count represented in a cell on a separate worksheet. Thanks a lot
for all your help.

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
Need help on formula with multiple conditions... DiDi Excel Discussion (Misc queries) 11 April 17th 06 05:33 PM
Multiple conditions in a formula TV Excel Worksheet Functions 3 April 12th 06 08:32 PM
formula to fill text with multiple conditions jerry Excel Discussion (Misc queries) 2 September 8th 05 11:26 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Sum(if ... multiple conditions ... Interpretation? Ken Excel Discussion (Misc queries) 6 December 16th 04 10:23 PM


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

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"