A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Counting with multiple matching criteria



 
 
Thread Tools Display Modes
  #11  
Old June 24th, 2009, 05:34 PM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein[_2_]
external usenet poster
 
Posts: 2,013
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  
Old June 24th, 2009, 06:10 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
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  
Old June 24th, 2009, 06:11 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
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




 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:46 AM.


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