#1   Report Post  
Carlos
 
Posts: n/a
Default CountIF

Hi,

I can't figure out the correct formula.

Code Date Wrong Correct
NC-01 12/05/05 0 1
NC-01 0
NC-01 0
NC-02 10/08/05 0 1
NC-02 12/08/05 1
NC-03 0
NC-03 0
NC-04 01/05/05 1 1
NC-05 30/05/05 1 1

The idea is, if the code has a date then it will give a count 1, otherwise
0. My formula in column C (Wrong column) is =IF(A2=A3,0,IF(B2="",0,1)). In
this case, I should have a 4 Codes with dates. What sort of trick to use to
give me the correct count? Please advise. Thanks in advance.

Carlos
  #2   Report Post  
Max
 
Posts: n/a
Default

One way to try ..
Put in C2: = --AND(ISNUMBER(B2),B2<0)
Copy down
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Carlos" wrote in message
...
Hi,

I can't figure out the correct formula.

Code Date Wrong Correct
NC-01 12/05/05 0 1
NC-01 0
NC-01 0
NC-02 10/08/05 0 1
NC-02 12/08/05 1
NC-03 0
NC-03 0
NC-04 01/05/05 1 1
NC-05 30/05/05 1 1

The idea is, if the code has a date then it will give a count 1, otherwise
0. My formula in column C (Wrong column) is =IF(A2=A3,0,IF(B2="",0,1)). In
this case, I should have a 4 Codes with dates. What sort of trick to use

to
give me the correct count? Please advise. Thanks in advance.

Carlos



  #3   Report Post  
Biff
 
Posts: n/a
Default

Hi!

If you're using this as a helper formula and your true goal is to count
unique codes that have a date:

Entered as an array with the key combo of CTRL,SHIFT,ENTER:

=SUM(N(FREQUENCY(IF(B2:B100,MATCH(A2:A10,A2:A10,0 )),MATCH(A2:A10,A2:A10,0))0))

If that's not what you're trying to do:

Enter this formula in C2 and copy down as needed:

=IF(AND(A1<A2,B20),1,"")

Note: A1 in the above formula is not a typo.

Biff

"Carlos" wrote in message
...
Hi,

I can't figure out the correct formula.

Code Date Wrong Correct
NC-01 12/05/05 0 1
NC-01 0
NC-01 0
NC-02 10/08/05 0 1
NC-02 12/08/05 1
NC-03 0
NC-03 0
NC-04 01/05/05 1 1
NC-05 30/05/05 1 1

The idea is, if the code has a date then it will give a count 1, otherwise
0. My formula in column C (Wrong column) is =IF(A2=A3,0,IF(B2="",0,1)). In
this case, I should have a 4 Codes with dates. What sort of trick to use
to
give me the correct count? Please advise. Thanks in advance.

Carlos



  #4   Report Post  
Carlos
 
Posts: n/a
Default

Thank you guys for quick reply.

Max's formula give me 5 counts.

Biff's two formulas give me the correct answer I want. I never thought of
using AND function. . great!

Thanks again.

Carlos




"Biff" wrote:

Hi!

If you're using this as a helper formula and your true goal is to count
unique codes that have a date:

Entered as an array with the key combo of CTRL,SHIFT,ENTER:

=SUM(N(FREQUENCY(IF(B2:B100,MATCH(A2:A10,A2:A10,0 )),MATCH(A2:A10,A2:A10,0))0))

If that's not what you're trying to do:

Enter this formula in C2 and copy down as needed:

=IF(AND(A1<A2,B20),1,"")

Note: A1 in the above formula is not a typo.

Biff

"Carlos" wrote in message
...
Hi,

I can't figure out the correct formula.

Code Date Wrong Correct
NC-01 12/05/05 0 1
NC-01 0
NC-01 0
NC-02 10/08/05 0 1
NC-02 12/08/05 1
NC-03 0
NC-03 0
NC-04 01/05/05 1 1
NC-05 30/05/05 1 1

The idea is, if the code has a date then it will give a count 1, otherwise
0. My formula in column C (Wrong column) is =IF(A2=A3,0,IF(B2="",0,1)). In
this case, I should have a 4 Codes with dates. What sort of trick to use
to
give me the correct count? Please advise. Thanks in advance.

Carlos




  #5   Report Post  
Carlos
 
Posts: n/a
Default

Biff/Max

Seems to be a problem using the formula C2 =IF(AND(A1<A2,B20),1,"") for
some other rows. Say, what if the date for NC-01 is at B4 (rather than B2
previously), it doesn't give 1.

Code Date Count
NC-01
NC-01
NC-01 12/05/05
NC-02 10/08/05 1
NC-02 12/08/05
NC-03
NC-03
NC-04 01/05/05 1
NC-05 30/05/05 1

However, the longer formula
(=SUM(N(FREQUENCY(IF(B2:B100,MATCH(A2:A10,A2:A10, 0)),MATCH(A2:A10,A2:A10,0))0)) works fine.

Carlos





"Carlos" wrote:

Thank you guys for quick reply.

Max's formula give me 5 counts.

Biff's two formulas give me the correct answer I want. I never thought of
using AND function. . great!

Thanks again.

Carlos




"Biff" wrote:

Hi!

If you're using this as a helper formula and your true goal is to count
unique codes that have a date:

Entered as an array with the key combo of CTRL,SHIFT,ENTER:

=SUM(N(FREQUENCY(IF(B2:B100,MATCH(A2:A10,A2:A10,0 )),MATCH(A2:A10,A2:A10,0))0))

If that's not what you're trying to do:

Enter this formula in C2 and copy down as needed:

=IF(AND(A1<A2,B20),1,"")

Note: A1 in the above formula is not a typo.

Biff

"Carlos" wrote in message
...
Hi,

I can't figure out the correct formula.

Code Date Wrong Correct
NC-01 12/05/05 0 1
NC-01 0
NC-01 0
NC-02 10/08/05 0 1
NC-02 12/08/05 1
NC-03 0
NC-03 0
NC-04 01/05/05 1 1
NC-05 30/05/05 1 1

The idea is, if the code has a date then it will give a count 1, otherwise
0. My formula in column C (Wrong column) is =IF(A2=A3,0,IF(B2="",0,1)). In
this case, I should have a 4 Codes with dates. What sort of trick to use
to
give me the correct count? Please advise. Thanks in advance.

Carlos






  #6   Report Post  
Max
 
Posts: n/a
Default

Max's formula give me 5 counts.

First, my apologies for missing the significance of your line:
... I should have a 4 Codes with dates ...

which inferred that the counts were to be for unique codes

A non-array alternative to try would be to put:

In C2: =IF(AND(ISNUMBER(B2),B2<0),A2,"")
In D2: = --(AND(C2<"",COUNTIF($C$2:C2,C2)=1))

Then select C2:D2 and fill down

Col D will return the count results that you seek

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


  #7   Report Post  
Carlos
 
Posts: n/a
Default

Max,

Thanks, thanks.... and thanks. That's exactly what I need. Just wonder what
does the two dashes "--" means in D2 formula?

Rgrds
Carlos

"Max" wrote:

Max's formula give me 5 counts.


First, my apologies for missing the significance of your line:
... I should have a 4 Codes with dates ...

which inferred that the counts were to be for unique codes

A non-array alternative to try would be to put:

In C2: =IF(AND(ISNUMBER(B2),B2<0),A2,"")
In D2: = --(AND(C2<"",COUNTIF($C$2:C2,C2)=1))

Then select C2:D2 and fill down

Col D will return the count results that you seek

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----



  #8   Report Post  
Max
 
Posts: n/a
Default

Glad to hear it's of some help <g !

.. what does the two dashes "--" mean in D2 formula?


The "--" is what they call a double unary which coerces the TRUE / FALSE
returns in the comparisons evaluated within the parens to numeric 1's / 0's
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Carlos" wrote in message
...
Max,

Thanks, thanks.... and thanks. That's exactly what I need. Just wonder

what
does the two dashes "--" means in D2 formula?

Rgrds
Carlos



  #9   Report Post  
Carlos
 
Posts: n/a
Default

Mmmm..... i guess i don't need to know it further and seems i have a lot more
things to know about Excel. Thanks again.

God bless.

Carlos

"Max" wrote:

Glad to hear it's of some help <g !

.. what does the two dashes "--" mean in D2 formula?


The "--" is what they call a double unary which coerces the TRUE / FALSE
returns in the comparisons evaluated within the parens to numeric 1's / 0's
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Carlos" wrote in message
...
Max,

Thanks, thanks.... and thanks. That's exactly what I need. Just wonder

what
does the two dashes "--" means in D2 formula?

Rgrds
Carlos




  #10   Report Post  
Max
 
Posts: n/a
Default

You're welcome, Carlos !
Thanks for the feedback ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


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
COUNTIF COMBINATION?? Heather Excel Worksheet Functions 1 April 26th 05 02:44 AM
Combining IF and COUNTIF based on two columns maxtrixx Excel Discussion (Misc queries) 5 March 31st 05 06:21 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM
Countif - Countif maswinney Excel Worksheet Functions 3 November 15th 04 11:06 PM
countif, again Liz G Excel Worksheet Functions 2 November 1st 04 11:20 PM


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