PC Review


Reply
Thread Tools Rate Thread

Count change in state

 
 
Keith Rathband
Guest
Posts: n/a
 
      14th Jun 2007
I have a load of values in a spreadsheet which are either true or false.

I need to count how many times it changes from false to true, bearing in
mind several true values may follow each other - before returning to false.

ie

TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE


the result would be 3 - ie it changed from FALSE to TRUE 3 times.

Thanks in advance.




 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      14th Jun 2007
I count 2 in your test data.

And I counted 2 using this formula (with your data in A1:A9:

=SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))

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 here:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

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

Keith Rathband wrote:
>
> I have a load of values in a spreadsheet which are either true or false.
>
> I need to count how many times it changes from false to true, bearing in
> mind several true values may follow each other - before returning to false.
>
> ie
>
> TRUE
> FALSE
> FALSE
> TRUE
> TRUE
> TRUE
> FALSE
> FALSE
> TRUE
>
> the result would be 3 - ie it changed from FALSE to TRUE 3 times.
>
> Thanks in advance.


--

Dave Peterson
 
Reply With Quote
 
Keith Rathband
Guest
Posts: n/a
 
      14th Jun 2007
Thanks,

mmm - your correct it is 2.

Perhaps i could try a different way..

How about counting how many cells are = true, but ignore cells in which the
cell above is also = true, is this possible?


"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I count 2 in your test data.
>
> And I counted 2 using this formula (with your data in A1:A9:
>
> =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))
>
> 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 here:
> http://www.xldynamic.com/source/xld.SUMPRODUCT.html
>
> And J.E. McGimpsey has some notes at:
> http://mcgimpsey.com/excel/formulae/doubleneg.html
>
> Keith Rathband wrote:
> >
> > I have a load of values in a spreadsheet which are either true or false.
> >
> > I need to count how many times it changes from false to true, bearing in
> > mind several true values may follow each other - before returning to

false.
> >
> > ie
> >
> > TRUE
> > FALSE
> > FALSE
> > TRUE
> > TRUE
> > TRUE
> > FALSE
> > FALSE
> > TRUE
> >
> > the result would be 3 - ie it changed from FALSE to TRUE 3 times.
> >
> > Thanks in advance.

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      14th Jun 2007
Are you just trying to count the first cell in the range if it's true?

=SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))+(A1=TRUE)



Keith Rathband wrote:
>
> Thanks,
>
> mmm - your correct it is 2.
>
> Perhaps i could try a different way..
>
> How about counting how many cells are = true, but ignore cells in which the
> cell above is also = true, is this possible?
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I count 2 in your test data.
> >
> > And I counted 2 using this formula (with your data in A1:A9:
> >
> > =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))
> >
> > 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 here:
> > http://www.xldynamic.com/source/xld.SUMPRODUCT.html
> >
> > And J.E. McGimpsey has some notes at:
> > http://mcgimpsey.com/excel/formulae/doubleneg.html
> >
> > Keith Rathband wrote:
> > >
> > > I have a load of values in a spreadsheet which are either true or false.
> > >
> > > I need to count how many times it changes from false to true, bearing in
> > > mind several true values may follow each other - before returning to

> false.
> > >
> > > ie
> > >
> > > TRUE
> > > FALSE
> > > FALSE
> > > TRUE
> > > TRUE
> > > TRUE
> > > FALSE
> > > FALSE
> > > TRUE
> > >
> > > the result would be 3 - ie it changed from FALSE to TRUE 3 times.
> > >
> > > Thanks in advance.

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
Keith Rathband
Guest
Posts: n/a
 
      14th Jun 2007
The file i have is the output of a BMS system that logs an input and outputs
to a CSV file.

All i need to be able to do is work out how many time in input changed from
false to true.

My file contains 3000 values - i cant seem to get that formula to work on
anything but my small example ?

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Are you just trying to count the first cell in the range if it's true?
>
> =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))+(A1=TRUE)
>
>
>
> Keith Rathband wrote:
> >
> > Thanks,
> >
> > mmm - your correct it is 2.
> >
> > Perhaps i could try a different way..
> >
> > How about counting how many cells are = true, but ignore cells in which

the
> > cell above is also = true, is this possible?
> >
> > "Dave Peterson" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I count 2 in your test data.
> > >
> > > And I counted 2 using this formula (with your data in A1:A9:
> > >
> > > =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))
> > >
> > > 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 here:
> > > http://www.xldynamic.com/source/xld.SUMPRODUCT.html
> > >
> > > And J.E. McGimpsey has some notes at:
> > > http://mcgimpsey.com/excel/formulae/doubleneg.html
> > >
> > > Keith Rathband wrote:
> > > >
> > > > I have a load of values in a spreadsheet which are either true or

false.
> > > >
> > > > I need to count how many times it changes from false to true,

bearing in
> > > > mind several true values may follow each other - before returning to

> > false.
> > > >
> > > > ie
> > > >
> > > > TRUE
> > > > FALSE
> > > > FALSE
> > > > TRUE
> > > > TRUE
> > > > TRUE
> > > > FALSE
> > > > FALSE
> > > > TRUE
> > > >
> > > > the result would be 3 - ie it changed from FALSE to TRUE 3 times.
> > > >
> > > > Thanks in advance.
> > >
> > > --
> > >
> > > Dave Peterson

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Keith Rathband
Guest
Posts: n/a
 
      14th Jun 2007
Sorted it now - thanks.

"Keith Rathband" <(E-Mail Removed)> wrote in message
news:467157f0$0$90275$(E-Mail Removed)...
> The file i have is the output of a BMS system that logs an input and

outputs
> to a CSV file.
>
> All i need to be able to do is work out how many time in input changed

from
> false to true.
>
> My file contains 3000 values - i cant seem to get that formula to work on
> anything but my small example ?
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Are you just trying to count the first cell in the range if it's true?
> >
> > =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))+(A1=TRUE)
> >
> >
> >
> > Keith Rathband wrote:
> > >
> > > Thanks,
> > >
> > > mmm - your correct it is 2.
> > >
> > > Perhaps i could try a different way..
> > >
> > > How about counting how many cells are = true, but ignore cells in

which
> the
> > > cell above is also = true, is this possible?
> > >
> > > "Dave Peterson" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I count 2 in your test data.
> > > >
> > > > And I counted 2 using this formula (with your data in A1:A9:
> > > >
> > > > =SUMPRODUCT(--(A1:A8=FALSE),--(A2:A9=TRUE))
> > > >
> > > > 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 here:
> > > > http://www.xldynamic.com/source/xld.SUMPRODUCT.html
> > > >
> > > > And J.E. McGimpsey has some notes at:
> > > > http://mcgimpsey.com/excel/formulae/doubleneg.html
> > > >
> > > > Keith Rathband wrote:
> > > > >
> > > > > I have a load of values in a spreadsheet which are either true or

> false.
> > > > >
> > > > > I need to count how many times it changes from false to true,

> bearing in
> > > > > mind several true values may follow each other - before returning

to
> > > false.
> > > > >
> > > > > ie
> > > > >
> > > > > TRUE
> > > > > FALSE
> > > > > FALSE
> > > > > TRUE
> > > > > TRUE
> > > > > TRUE
> > > > > FALSE
> > > > > FALSE
> > > > > TRUE
> > > > >
> > > > > the result would be 3 - ie it changed from FALSE to TRUE 3 times.
> > > > >
> > > > > Thanks in advance.
> > > >
> > > > --
> > > >
> > > > Dave Peterson

> >
> > --
> >
> > Dave Peterson

>
>



 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      14th Jun 2007
> All i need to be able to do is work out how many time in input
> changed from false to true.


Does this formula do that?

=SUMPRODUCT(--(A2:A99<>A1:A98),--(A2:A99=TRUE))

Rick
 
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
Session State change =?Utf-8?B?Q2xpbnQgWmlua2lh?= Microsoft Windows 2000 Terminal Server Applications 1 24th Nov 2005 10:09 AM
can you change state to province =?Utf-8?B?aGFpbGV5dmF1Z2hu?= Microsoft Access 2 26th Jan 2005 03:13 AM
Change Line Count to not count blank lines =?Utf-8?B?Q2Fyb2w=?= Microsoft Word Document Management 4 27th Nov 2004 01:46 PM
Form state change Anatoli Trifonov Microsoft ASP .NET 1 17th Oct 2004 12:23 AM
Sorting by count and state Kyle Microsoft Excel Misc 2 5th Nov 2003 04:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.