#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default CountIF

=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CountIF

In general, each would have to be handled separately, but if the intervening
cells would not contain an X, then you wouldn't need to exclude them to get
the count.

=Countif(A3:A6,"X")+Countif(A9:A12,"X")+Countif(A1 5:A18,"X")

--
Regards,
Tom Ogilvy


"Arturo" wrote in message
...
=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default CountIF

A B C
1 S6 B2

I know how to use the countif function as if to count all values that equal
"S*" (value beginning with "S" only regardless of the following number) in a
row. Then tally, per row, the number of times "S*" appeared in the range.
The formula for "C1" would be: =countif(A1:B2,"S*") which right now would
return the value of 1. Now what I want to do is in addition to this formula,
I want "C1" to also calculate the countif portion and then multiply the
countif returned value by the second number in the stated cell. i.e. A1 =
S6, so "C1" has a value of "1", now mulitply the "1" by the second digit in
"A1" (which is 6). How would I go about this? Thanks.

Gee-off


"Tom Ogilvy" wrote:

In general, each would have to be handled separately, but if the intervening
cells would not contain an X, then you wouldn't need to exclude them to get
the count.

=Countif(A3:A6,"X")+Countif(A9:A12,"X")+Countif(A1 5:A18,"X")

--
Regards,
Tom Ogilvy


"Arturo" wrote in message
...
=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default CountIF

See response in .worksheet.functions

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Gee-off" wrote in message
...
A B C
1 S6 B2

I know how to use the countif function as if to count all values that

equal
"S*" (value beginning with "S" only regardless of the following number) in

a
row. Then tally, per row, the number of times "S*" appeared in the range.
The formula for "C1" would be: =countif(A1:B2,"S*") which right now

would
return the value of 1. Now what I want to do is in addition to this

formula,
I want "C1" to also calculate the countif portion and then multiply the
countif returned value by the second number in the stated cell. i.e. A1

=
S6, so "C1" has a value of "1", now mulitply the "1" by the second digit

in
"A1" (which is 6). How would I go about this? Thanks.

Gee-off


"Tom Ogilvy" wrote:

In general, each would have to be handled separately, but if the

intervening
cells would not contain an X, then you wouldn't need to exclude them to

get
the count.

=Countif(A3:A6,"X")+Countif(A9:A12,"X")+Countif(A1 5:A18,"X")

--
Regards,
Tom Ogilvy


"Arturo" wrote in message
...
=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that

formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default CountIF

=COUNTIF(A3:A6,"X")+COUNTIF(A9:A12,"X")+COUNTIF(A1 5:A18,"X")



"Arturo" wrote:

=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default CountIF

If they are structured as you show, you can use

=SUMPRODUCT(--(A3:A18="X"),--(MOD(INT(ROW(A3:A18)/3),2)=1))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Arturo" wrote in message
...
=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CountIF

That would work if the pattern were A3:A5,A9:A11,A15:A17, but unfortunately
it wasn't.

such as A3:A6,A9:A12,A15:A18?


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote in message
...
If they are structured as you show, you can use

=SUMPRODUCT(--(A3:A18="X"),--(MOD(INT(ROW(A3:A18)/3),2)=1))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Arturo" wrote in message
...
=COUNTIF(A3:A6,"X")

Returns the correct # of Xs in that range.
How do I incorporate additional non-contiguous ranges into that formula
correctly, such as A3:A6,A9:A12,A15:A18?

Sincerely,
Arturo





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
How do I use a countif function according to two other countif fu. Kirsty Excel Worksheet Functions 2 February 20th 06 11:44 AM
edit this =COUNTIF(A1:F16,"*1-2*")+COUNTIF(A1:F16,"*2-1*") sctroy Excel Discussion (Misc queries) 2 September 25th 05 04:13 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
COUNTIF nsharpe Excel Discussion (Misc queries) 7 September 7th 05 10:43 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM


All times are GMT +1. The time now is 12:39 AM.

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

About Us

"It's about Microsoft Excel"