Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

A colleague came to me yesterday and complained about the length of formulas.
She needs to count occurrences of values in a table that meet any of several
criteria. The table is pure text with no blanks. Her formula was something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring to
that table??

--
Gary''s Student - gsnu200858
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Counting with multiple matching criteria


If you array-enter (CSE) your formula, it gives you the results.. I
think.

or use:

=SUMPRODUCT(COUNTIF(G7:G3147,K1:K4))


--
NBVC

Where there is a will there are many ways.
------------------------------------------------------------------------
NBVC's Profile: http://www.thecodecage.com/forumz/member.php?userid=74
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109662

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Counting with multiple matching criteria

Try
=SUMPRODUCT(COUNTIF(G7:G3147,Z1:Z4))

=SUM(COUNTIF(G7:G3147,Z1:Z4))
'is an array formula..

If this post helps click Yes
---------------
Jacob Skaria


"Gary''s Student" wrote:

A colleague came to me yesterday and complained about the length of formulas.
She needs to count occurrences of values in a table that meet any of several
criteria. The table is pure text with no blanks. Her formula was something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring to
that table??

--
Gary''s Student - gsnu200858

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

Thanks!
--
Gary''s Student - gsnu200858


"NBVC" wrote:


If you array-enter (CSE) your formula, it gives you the results.. I
think.

or use:

=SUMPRODUCT(COUNTIF(G7:G3147,K1:K4))


--
NBVC

Where there is a will there are many ways.
------------------------------------------------------------------------
NBVC's Profile: http://www.thecodecage.com/forumz/member.php?userid=74
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109662


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

Thanks!
--
Gary''s Student - gsnu200858


"Jacob Skaria" wrote:

Try
=SUMPRODUCT(COUNTIF(G7:G3147,Z1:Z4))

=SUM(COUNTIF(G7:G3147,Z1:Z4))
'is an array formula..

If this post helps click Yes
---------------
Jacob Skaria


"Gary''s Student" wrote:

A colleague came to me yesterday and complained about the length of formulas.
She needs to count occurrences of values in a table that meet any of several
criteria. The table is pure text with no blanks. Her formula was something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring to
that table??

--
Gary''s Student - gsnu200858



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Counting with multiple matching criteria

Hi,

Here's a short one:

=SUMPRODUCT(--(G1:G10=W1:Z1))

Adjust the ranges but note that the criteria W1:Z1 need to run horizontally
to keep the formula this short.
--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Gary''s Student" wrote:

A colleague came to me yesterday and complained about the length of formulas.
She needs to count occurrences of values in a table that meet any of several
criteria. The table is pure text with no blanks. Her formula was something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring to
that table??

--
Gary''s Student - gsnu200858

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

Thank you Shane - a very clever idea!
--
Gary''s Student - gsnu200858


"Shane Devenshire" wrote:

Hi,

Here's a short one:

=SUMPRODUCT(--(G1:G10=W1:Z1))

Adjust the ranges but note that the criteria W1:Z1 need to run horizontally
to keep the formula this short.
--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Gary''s Student" wrote:

A colleague came to me yesterday and complained about the length of formulas.
She needs to count occurrences of values in a table that meet any of several
criteria. The table is pure text with no blanks. Her formula was something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring to
that table??

--
Gary''s Student - gsnu200858

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Counting with multiple matching criteria

I'm assuming that there are more entry possibilities than the four you
listed and that she wants to count only those four items from among all the
possible entries (otherwise a simple COUNTA function call would work). Using
the concept Shane posted, but modifying it for the search items to be listed
in a column (J1:J4 in my formula) rather than a row (W1:Z1 in Shane's
formula), this array-entered formula should work...

=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))

I found it interesting that using SUMPRODUCT instead of SUM did not work
correctly unless you array-entered it.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting with multiple matching criteria

Listed in order of efficiency:

=COUNTIF(A:A,B1)+COUNTIF(A:A,C1)+COUNTIF(A:A,D1)+C OUNTIF(A:A,E1)

=SUMPRODUCT(COUNTIF(A:A,B1:E1))

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A3500,B1:E1,0))))

=SUM(--(A1:A3500=TRANSPOSE(B1:B4)))

=SUMPRODUCT(--(A1:A3500=B1:E1))

--
Biff
Microsoft Excel MVP


"Gary''s Student" wrote in message
...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()'s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858



  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting with multiple matching criteria

=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))
I found it interesting that using SUMPRODUCT instead
of SUM did not work correctly unless you array-entered it.


TRANSPOSE requires array entry.

--
Biff
Microsoft Excel MVP


"Rick Rothstein" wrote in message
...
I'm assuming that there are more entry possibilities than the four you
listed and that she wants to count only those four items from among all
the possible entries (otherwise a simple COUNTA function call would work).
Using the concept Shane posted, but modifying it for the search items to
be listed in a column (J1:J4 in my formula) rather than a row (W1:Z1 in
Shane's formula), this array-entered formula should work...

=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))

I found it interesting that using SUMPRODUCT instead of SUM did not work
correctly unless you array-entered it.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in
message ...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()'s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858






  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Counting with multiple matching criteria

I was thinking that SUMPRODUCT, being an array-processing function, would
have imposed the array processing on the elements in the formula.

--
Rick (MVP - Excel)


"T. Valko" wrote in message
...
=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))
I found it interesting that using SUMPRODUCT instead
of SUM did not work correctly unless you array-entered it.


TRANSPOSE requires array entry.

--
Biff
Microsoft Excel MVP


"Rick Rothstein" wrote in message
...
I'm assuming that there are more entry possibilities than the four you
listed and that she wants to count only those four items from among all
the possible entries (otherwise a simple COUNTA function call would
work). Using the concept Shane posted, but modifying it for the search
items to be listed in a column (J1:J4 in my formula) rather than a row
(W1:Z1 in Shane's formula), this array-entered formula should work...

=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))

I found it interesting that using SUMPRODUCT instead of SUM did not work
correctly unless you array-entered it.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in
message ...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review
complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()'s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858





  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

Thanks Rick
--
Gary''s Student - gsnu200858


"Rick Rothstein" wrote:

I'm assuming that there are more entry possibilities than the four you
listed and that she wants to count only those four items from among all the
possible entries (otherwise a simple COUNTA function call would work). Using
the concept Shane posted, but modifying it for the search items to be listed
in a column (J1:J4 in my formula) rather than a row (W1:Z1 in Shane's
formula), this array-entered formula should work...

=SUM(--(G$1:G$100=TRANSPOSE(J1:J4)))

I found it interesting that using SUMPRODUCT instead of SUM did not work
correctly unless you array-entered it.

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858



  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Counting with multiple matching criteria

Thanks Biff
--
Gary''s Student - gsnu200858


"T. Valko" wrote:

Listed in order of efficiency:

=COUNTIF(A:A,B1)+COUNTIF(A:A,C1)+COUNTIF(A:A,D1)+C OUNTIF(A:A,E1)

=SUMPRODUCT(COUNTIF(A:A,B1:E1))

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A3500,B1:E1,0))))

=SUM(--(A1:A3500=TRANSPOSE(B1:B4)))

=SUMPRODUCT(--(A1:A3500=B1:E1))

--
Biff
Microsoft Excel MVP


"Gary''s Student" wrote in message
...
A colleague came to me yesterday and complained about the length of
formulas.
She needs to count occurrences of values in a table that meet any of
several
criteria. The table is pure text with no blanks. Her formula was
something
like:

=COUNTIF(G7:G3147,"open")+COUNTIF(G7:G3147,"pendin g
review")+COUNTIF(G7:G3147,"review complete")+COUNTIF(G7:G3147,"assigned")

I pointed out that she did not need repeated COUNTIF()'s and to use:

=SUM(COUNTIF(G7:G3147,{"open","pending review","review
complete","assigned"}))

She was satisfied, but returned this morning and wanted to know if the
criteria could be completely removed from the formula and stored in a
table.

I put the match values in Z1 thru Z4 and tried:

=SUM(COUNTIF(G7:G3147,Z1:Z4)) but this returns zero.

Any suggestions for putting the criteria in a little table and referring
to
that table??

--
Gary''s Student - gsnu200858




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
counting matching multiple entries colensa Excel Discussion (Misc queries) 2 May 17th 09 09:11 PM
MAX value matching multiple criteria mwd Excel Worksheet Functions 10 May 12th 08 07:42 PM
return multiple records matching multiple criteria Karthik Excel Worksheet Functions 2 March 22nd 06 04:42 PM
Counting Cells with multiple criteria.One criteria supporting wild Azhar Saleem Excel Worksheet Functions 1 January 12th 05 10:54 AM
Counting Cells with multiple criteria.One criteria supporting wild Azhar Arain Excel Worksheet Functions 1 January 12th 05 08:33 AM


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