Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Please help with Count or Countif...

Hi all. I did try searching this group for answers, but couldn't find
an example for exactly what I'm trying to do, although I'm sure it is
quite simple (I'm and excel rookie...).

Two columns, A & B:
1 n
1 a
1
2
2 c
2
1
1 y

How do I do a count of how many rows have the "2" (text, not number)
in column A -and- have non-blank in column B (so any text value in
column B)?
So in the above case, I would want the result to be a count of 1, for
the row that had 2 c.......

Thanks!!!!!!!!!!!!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Please help with Count or Countif...

=SUMPRODUCT((A1:A8="2")*(B1:B8<""))
or
=SUMPRODUCT(--(A1:A8="2"),--(B1:B8<""))
--
David Biddulph

wrote in message
oups.com...
Hi all. I did try searching this group for answers, but couldn't find
an example for exactly what I'm trying to do, although I'm sure it is
quite simple (I'm and excel rookie...).

Two columns, A & B:
1 n
1 a
1
2
2 c
2
1
1 y

How do I do a count of how many rows have the "2" (text, not number)
in column A -and- have non-blank in column B (so any text value in
column B)?
So in the above case, I would want the result to be a count of 1, for
the row that had 2 c.......

Thanks!!!!!!!!!!!!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Please help with Count or Countif...

=sumproduct(--(a1:a99="2"),--(b1:b99<""))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

wrote:

Hi all. I did try searching this group for answers, but couldn't find
an example for exactly what I'm trying to do, although I'm sure it is
quite simple (I'm and excel rookie...).

Two columns, A & B:
1 n
1 a
1
2
2 c
2
1
1 y

How do I do a count of how many rows have the "2" (text, not number)
in column A -and- have non-blank in column B (so any text value in
column B)?
So in the above case, I would want the result to be a count of 1, for
the row that had 2 c.......

Thanks!!!!!!!!!!!!


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Please help with Count or Countif...

Try
=sumproduct(--(A1:A100="2"),--(B1:B100<""))
the --( changes the logical true false to numeric 1 0.
the arrays have to be the same size but cannot be a full column, at least in
pre 2007

" wrote:

Hi all. I did try searching this group for answers, but couldn't find
an example for exactly what I'm trying to do, although I'm sure it is
quite simple (I'm and excel rookie...).

Two columns, A & B:
1 n
1 a
1
2
2 c
2
1
1 y

How do I do a count of how many rows have the "2" (text, not number)
in column A -and- have non-blank in column B (so any text value in
column B)?
So in the above case, I would want the result to be a count of 1, for
the row that had 2 c.......

Thanks!!!!!!!!!!!!


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Please help with Count or Countif...

Thank you, the
=sumproduct(--(A1:A100="2"),--(B1:B100<""))

worked!

Next question though.......what if I want to do the same sort of
thing, except this time I only want to include where column B -is-
blank?
I tried substituting and equal sign instead of <, but it just picks
up every row....
thx again!




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Please help with Count or Countif...

= instead of < should do the trick. You need to check your formula again
if it's counting every row.
--
David Biddulph

wrote in message
ps.com...
Thank you, the
=sumproduct(--(A1:A100="2"),--(B1:B100<""))

worked!

Next question though.......what if I want to do the same sort of
thing, except this time I only want to include where column B -is-
blank?
I tried substituting and equal sign instead of <, but it just picks
up every row....
thx again!



  #7   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Please help with Count or Countif...

I don't know why the equal would not work
but try
=sumproduct(--(A1:A100="2"),--not(B1:B100<""))

" wrote:

Thank you, the
=sumproduct(--(A1:A100="2"),--(B1:B100<""))

worked!

Next question though.......what if I want to do the same sort of
thing, except this time I only want to include where column B -is-
blank?
I tried substituting and equal sign instead of <, but it just picks
up every row....
thx again!



  #8   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Please help with Count or Countif...

In the example It gave you three?

another method would be
=countif(A1:A100,"2")-sumproduct(--(A1:A100="2"),--(B1:B100<""))

" wrote:

Thank you, the
=sumproduct(--(A1:A100="2"),--(B1:B100<""))

worked!

Next question though.......what if I want to do the same sort of
thing, except this time I only want to include where column B -is-
blank?
I tried substituting and equal sign instead of <, but it just picks
up every row....
thx again!



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
Complex Count/CountIf calc Sarah (OGI) Excel Worksheet Functions 3 May 1st 07 03:47 PM
how can I count (countif) the character: * Mousquito Excel Worksheet Functions 1 October 9th 06 12:20 PM
count many with COUNTIF? Bob Excel Worksheet Functions 4 October 2nd 06 07:06 AM
Can one count cells having a certain format? i.e. using countif? KristinG Excel Worksheet Functions 1 August 8th 06 07:00 PM
Count, Countif, Sumif?? benjam_in Excel Worksheet Functions 6 July 12th 06 06:29 PM


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