PC Review


Reply
Thread Tools Rate Thread

count recurring yes/no type data

 
 
=?Utf-8?B?UGVnZ3kgU3Vl?=
Guest
Posts: n/a
 
      8th Jun 2006
I am not sure if this is possible..... I am working in a large spreadsheet
containing inventory counts. I want to be able to display if an item is
growing over period of months. Is there a way to do a count or something
that would return the number of months this would be increasing, 0=no
increase, 1=increase?
Jan Feb Mar Apr May Jun Jul Answer
0 1 1 1 1 0 0 4
1 0 0 0 1 1 0 2
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      8th Jun 2006
=SUMPRODUCT(--(A2:F2=1),--(B2:G2=1))+1

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Peggy Sue" <(E-Mail Removed)> wrote in message
news:F83E45B6-F24D-4C1C-9699-(E-Mail Removed)...
> I am not sure if this is possible..... I am working in a large

spreadsheet
> containing inventory counts. I want to be able to display if an item is
> growing over period of months. Is there a way to do a count or something
> that would return the number of months this would be increasing, 0=no
> increase, 1=increase?
> Jan Feb Mar Apr May Jun Jul Answer
> 0 1 1 1 1 0 0 4
> 1 0 0 0 1 1 0 2



 
Reply With Quote
 
=?Utf-8?B?UGVnZ3kgU3Vl?=
Guest
Posts: n/a
 
      8th Jun 2006
Thanks for your reply. This won't show me the the number of consecutive
months for each row that have a value of 1 will it? I am looking to count
the highest number of recurring "1"s. Maybe Excel can't do this......

Another Example

Part# jan feb mar apr may jun Answer:
65145 0 0 0 1 1 1 3
64135 1 1 1 1 0 1 4
68112 1 0 1 1 1 0 3



"Bob Phillips" wrote:

> =SUMPRODUCT(--(A2:F2=1),--(B2:G2=1))+1
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Peggy Sue" <(E-Mail Removed)> wrote in message
> news:F83E45B6-F24D-4C1C-9699-(E-Mail Removed)...
> > I am not sure if this is possible..... I am working in a large

> spreadsheet
> > containing inventory counts. I want to be able to display if an item is
> > growing over period of months. Is there a way to do a count or something
> > that would return the number of months this would be increasing, 0=no
> > increase, 1=increase?
> > Jan Feb Mar Apr May Jun Jul Answer
> > 0 1 1 1 1 0 0 4
> > 1 0 0 0 1 1 0 2

>
>
>

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      9th Jun 2006
It gets exactly those answer in my tests. Needs to be adjusted to the
ranges, =SUMPRODUCT(--(B2:F2=1),--(C2:G2=1))+1, but other than that ...

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Peggy Sue" <(E-Mail Removed)> wrote in message
news:25D3F989-0290-4D47-8961-(E-Mail Removed)...
> Thanks for your reply. This won't show me the the number of consecutive
> months for each row that have a value of 1 will it? I am looking to count
> the highest number of recurring "1"s. Maybe Excel can't do this......
>
> Another Example
>
> Part# jan feb mar apr may jun

Answer:
> 65145 0 0 0 1 1 1

3
> 64135 1 1 1 1 0 1

4
> 68112 1 0 1 1 1 0

3
>
>
>
> "Bob Phillips" wrote:
>
> > =SUMPRODUCT(--(A2:F2=1),--(B2:G2=1))+1
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Peggy Sue" <(E-Mail Removed)> wrote in message
> > news:F83E45B6-F24D-4C1C-9699-(E-Mail Removed)...
> > > I am not sure if this is possible..... I am working in a large

> > spreadsheet
> > > containing inventory counts. I want to be able to display if an item

is
> > > growing over period of months. Is there a way to do a count or

something
> > > that would return the number of months this would be increasing, 0=no
> > > increase, 1=increase?
> > > Jan Feb Mar Apr May Jun Jul Answer
> > > 0 1 1 1 1 0 0 4
> > > 1 0 0 0 1 1 0 2

> >
> >
> >



 
Reply With Quote
 
kounoike
Guest
Posts: n/a
 
      9th Jun 2006
This way is to make UDF something like

Function counttest(rng As Range) As Long
Application.Volatile
Dim st0 As Boolean, st1 As Boolean
Dim s As Long, state As Long, j As Long
Dim rec() As Long
ReDim rec(rng.Count)
st0 = False
st1 = False
For Each rng In rng
If rng.Value = 1 Then
st1 = True
Else
st1 = False
End If

If st0 And st1 Then
state = 1
ElseIf st0 And (Not st1) Then
state = 2
ElseIf (Not st0) And st1 Then
state = 3
End If

Select Case state
Case 1
s = s + 1
Case 2
rec(j) = s
j = j + 1
s = 0
st0 = st1
Case 3
s = s + 1
st0 = st1
Case Else

End Select
Next
counttest = Application.Max(rec)
End Function

and apply this function in your worksheet.
assumeing your data are populated in "b2:g2" and answer in "i2", then
put the formula in "i2"
=countertest(B2:G2)
will return 3.
if you need a answer in "i3", drag and copy above formula to "i3".

keizi

"Peggy Sue" <(E-Mail Removed)> wrote in message
news:25D3F989-0290-4D47-8961-(E-Mail Removed)...
> Thanks for your reply. This won't show me the the number of

consecutive
> months for each row that have a value of 1 will it? I am looking to

count
> the highest number of recurring "1"s. Maybe Excel can't do this......
>
> Another Example
>
> Part# jan feb mar apr may jun

Answer:
> 65145 0 0 0 1 1 1

3
> 64135 1 1 1 1 0 1

4
> 68112 1 0 1 1 1 0

3
>
>
>
> "Bob Phillips" wrote:
>
> > =SUMPRODUCT(--(A2:F2=1),--(B2:G2=1))+1
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "Peggy Sue" <(E-Mail Removed)> wrote in message
> > news:F83E45B6-F24D-4C1C-9699-(E-Mail Removed)...
> > > I am not sure if this is possible..... I am working in a large

> > spreadsheet
> > > containing inventory counts. I want to be able to display if an

item is
> > > growing over period of months. Is there a way to do a count or

something
> > > that would return the number of months this would be increasing,

0=no
> > > increase, 1=increase?
> > > Jan Feb Mar Apr May Jun Jul Answer
> > > 0 1 1 1 1 0 0 4
> > > 1 0 0 0 1 1 0 2

> >
> >
> >


 
Reply With Quote
 
=?Utf-8?B?UGVnZ3kgU3Vl?=
Guest
Posts: n/a
 
      9th Jun 2006
You are right - I must have entered it wrong the first time - thank you!

"Bob Phillips" wrote:

> It gets exactly those answer in my tests. Needs to be adjusted to the
> ranges, =SUMPRODUCT(--(B2:F2=1),--(C2:G2=1))+1, but other than that ...
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Peggy Sue" <(E-Mail Removed)> wrote in message
> news:25D3F989-0290-4D47-8961-(E-Mail Removed)...
> > Thanks for your reply. This won't show me the the number of consecutive
> > months for each row that have a value of 1 will it? I am looking to count
> > the highest number of recurring "1"s. Maybe Excel can't do this......
> >
> > Another Example
> >
> > Part# jan feb mar apr may jun

> Answer:
> > 65145 0 0 0 1 1 1

> 3
> > 64135 1 1 1 1 0 1

> 4
> > 68112 1 0 1 1 1 0

> 3
> >
> >
> >
> > "Bob Phillips" wrote:
> >
> > > =SUMPRODUCT(--(A2:F2=1),--(B2:G2=1))+1
> > >
> > > --
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace somewhere in email address with gmail if mailing direct)
> > >
> > > "Peggy Sue" <(E-Mail Removed)> wrote in message
> > > news:F83E45B6-F24D-4C1C-9699-(E-Mail Removed)...
> > > > I am not sure if this is possible..... I am working in a large
> > > spreadsheet
> > > > containing inventory counts. I want to be able to display if an item

> is
> > > > growing over period of months. Is there a way to do a count or

> something
> > > > that would return the number of months this would be increasing, 0=no
> > > > increase, 1=increase?
> > > > Jan Feb Mar Apr May Jun Jul Answer
> > > > 0 1 1 1 1 0 0 4
> > > > 1 0 0 0 1 1 0 2
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Data type mismatch in criteria expression' error in Count query Al Microsoft Access Queries 2 29th May 2009 04:32 AM
'Data type mismatch in criteria expression' error in Count query Al Microsoft Access Queries 1 25th May 2009 04:01 PM
Recurring Days That Count Up =?Utf-8?B?Um9uIEFudGhvbnkgUXVpbm4=?= Microsoft Outlook Calendar 0 10th May 2006 06:37 PM
display count of recurring appointments =?Utf-8?B?VHlsZXI=?= Microsoft Outlook Calendar 0 18th Sep 2005 03:44 PM
Double data type count number of decimal places? =?Utf-8?B?YW5kcm9pZA==?= Microsoft C# .NET 3 19th Apr 2004 05:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.