Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mlkpied
 
Posts: n/a
Default Countif with AND logic

I have a worksheet where I'm try to count the number of items with JobCode=P
and an amount greater than 0. I think I should be able to do it with a
COUNTIF and AND logic but I keep getting errors. Anyone help me with this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10

  #2   Report Post  
JulieD
 
Posts: n/a
Default

Hi

you need to use the SUMPRODUCT function
=SUMPRODUCT(--(A1:A10="P"),--(B1:B100))

check out
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

for details on how this works

cheers
JulieD


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with
JobCode=P
and an amount greater than 0. I think I should be able to do it with a
COUNTIF and AND logic but I keep getting errors. Anyone help me with this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10



  #3   Report Post  
CLR
 
Posts: n/a
Default

Another way is to CONCATENATE the two columns into a third column and then
do a COUNTIF on that column, (P20).........you can also so this for more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with

JobCode=P
and an amount greater than 0. I think I should be able to do it with a
COUNTIF and AND logic but I keep getting errors. Anyone help me with this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10



  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third column and then
do a COUNTIF on that column, (P20).........you can also so this for more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with

JobCode=P
and an amount greater than 0. I think I should be able to do it with a
COUNTIF and AND logic but I keep getting errors. Anyone help me with

this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10





  #5   Report Post  
CLR
 
Posts: n/a
Default

Maybe, but this seems to work with the OP's sample data...........
=A1&"_"&B1 in C1 and copy down..............

=COUNTIF(C:C,"P_0") in cell D1

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third column and

then
do a COUNTIF on that column, (P20).........you can also so this for more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with

JobCode=P
and an amount greater than 0. I think I should be able to do it with a
COUNTIF and AND logic but I keep getting errors. Anyone help me with

this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10









  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

Yeah but a value of Q in A and 0 in B also counts in this method, which
doesn't meet the OP's criteria.

Bob


"CLR" wrote in message
...
Maybe, but this seems to work with the OP's sample data...........
=A1&"_"&B1 in C1 and copy down..............

=COUNTIF(C:C,"P_0") in cell D1

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third column and

then
do a COUNTIF on that column, (P20).........you can also so this for

more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with
JobCode=P
and an amount greater than 0. I think I should be able to do it with

a
COUNTIF and AND logic but I keep getting errors. Anyone help me with

this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10









  #7   Report Post  
CLR
 
Posts: n/a
Default

True, but then how about.....

=COUNTIF(C:C,"P_0")-COUNTIF(C:C,"=Q_0")

it seems to fit, but then like you said, "it's getting difficult" <g

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Yeah but a value of Q in A and 0 in B also counts in this method, which
doesn't meet the OP's criteria.

Bob


"CLR" wrote in message
...
Maybe, but this seems to work with the OP's sample data...........
=A1&"_"&B1 in C1 and copy down..............

=COUNTIF(C:C,"P_0") in cell D1

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third column

and
then
do a COUNTIF on that column, (P20).........you can also so this for

more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items with
JobCode=P
and an amount greater than 0. I think I should be able to do it

with
a
COUNTIF and AND logic but I keep getting errors. Anyone help me

with
this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10











  #8   Report Post  
Bob Phillips
 
Posts: n/a
Default

Q was just an example, it is true of R, S, T, etc.

It works in a too restrictive set.

--

HTH

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


"CLR" wrote in message
...
True, but then how about.....

=COUNTIF(C:C,"P_0")-COUNTIF(C:C,"=Q_0")

it seems to fit, but then like you said, "it's getting difficult" <g

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Yeah but a value of Q in A and 0 in B also counts in this method, which
doesn't meet the OP's criteria.

Bob


"CLR" wrote in message
...
Maybe, but this seems to work with the OP's sample data...........
=A1&"_"&B1 in C1 and copy down..............

=COUNTIF(C:C,"P_0") in cell D1

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third column

and
then
do a COUNTIF on that column, (P20).........you can also so this

for
more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items

with
JobCode=P
and an amount greater than 0. I think I should be able to do it

with
a
COUNTIF and AND logic but I keep getting errors. Anyone help me

with
this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10













  #9   Report Post  
CLR
 
Posts: n/a
Default

Maybe so, but the same modified formula seems to take care of the R,S,T, etc
conditions as well in my model.........

=COUNTIF(C:C,"P_0")-COUNTIF(C:C,"=Q_0")

Vaya con Dios,
Chuck, CABGx3



"Bob Phillips" wrote in message
...
Q was just an example, it is true of R, S, T, etc.

It works in a too restrictive set.

--

HTH

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


"CLR" wrote in message
...
True, but then how about.....

=COUNTIF(C:C,"P_0")-COUNTIF(C:C,"=Q_0")

it seems to fit, but then like you said, "it's getting difficult" <g

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Yeah but a value of Q in A and 0 in B also counts in this method,

which
doesn't meet the OP's criteria.

Bob


"CLR" wrote in message
...
Maybe, but this seems to work with the OP's sample data...........
=A1&"_"&B1 in C1 and copy down..............

=COUNTIF(C:C,"P_0") in cell D1

Vaya con Dios,
Chuck, CABGx3


"Bob Phillips" wrote in message
...
Difficult with greater than 0 Chuck!

--

HTH

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


"CLR" wrote in message
...
Another way is to CONCATENATE the two columns into a third

column
and
then
do a COUNTIF on that column, (P20).........you can also so this

for
more
than two columns.

Vaya con Dios,
Chuck, CABGx3


"mlkpied" wrote in message
...
I have a worksheet where I'm try to count the number of items

with
JobCode=P
and an amount greater than 0. I think I should be able to do

it
with
a
COUNTIF and AND logic but I keep getting errors. Anyone help

me
with
this?
Thanks. Michael

JobCode Amount
P 20
C 10
P 0
P 0
P 10















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



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