+ Reply to Thread
Results 1 to 19 of 19

Formula to count number of cells that are greater than the one before it

  1. #1
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Formula to count number of cells that are greater than the one before it

    Hey,

    Im looking for a formula to count the number of times that a cell is greater than the one before it. Below is a simplified version. But that answer in this case would be 3.

    Thanks for your help!!


    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    3
    3
    3
    3

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    Try array entering this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Dave

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    Another way still array entered
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to count number of cells that are greater than the one before it

    With your data in the range A2:A35...

    =SUMPRODUCT(--(A3:A35>A2:A34))

    Note how the ranges are offset.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,911

    Re: Formula to count number of cells that are greater than the one before it

    Regular formula ...

    =SUMPRODUCT(--($A$1:$A$33<$A$2:$A$34))

  6. #6
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Re: Formula to count number of cells that are greater than the one before it

    Thanks, that worked perfectly. Do you know how to base it on a criteria. So that it counts the number of increases based on the left columns. So in this case for 0.1=1., 0.2=1 and 0.5=2.

    Thanks!!

    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.5 3
    0.5 3
    0.5 4
    0.5 4
    0.5 4

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,911

    Re: Formula to count number of cells that are greater than the one before it

    Try this ...

    =SUMPRODUCT(--($A$1:$A$33<$B$1:$B$33))

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    Not certain I follow your meaning, but try array entering this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    I think I see it now. Just change Tony and Phuocam's formula to this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    It returns 4.

  10. #10
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Re: Formula to count number of cells that are greater than the one before it

    Thanks for your reply, but i don't think I made my meaning clear haha

    I am trying to use that sumproduct formula. But to count the number of cells based on another criteria (the probabilites eg 0.1, 0.2, 0.5) Hopes that makes a bit more sense!!

    Thanks

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    Then does this do it?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Re: Formula to count number of cells that are greater than the one before it

    Unfortunately not.

    I have a table at the top of the spread sheet that looks like this. And because the probability changes (.1,.2, .5) want to make a formula to automatically count the number of increases in the column at certain probabilities. So how many increases there are when the probability is .1. How many when the probability is .2 ect. Does that make sense?

    Items
    .1 1
    .2 1
    .5 1

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    Quote Originally Posted by deraj727 View Post
    Unfortunately not.

    I have a table at the top of the spread sheet that looks like this. And because the probability changes (.1,.2, .5) want to make a formula to automatically count the number of increases in the column at certain probabilities. So how many increases there are when the probability is .1. How many when the probability is .2 ect. Does that make sense?

    Items
    .1 1
    .2 1
    .5 1

    So where does this from post #6 fit in?
    So in this case for 0.1=1., 0.2=1 and 0.5=2.

  14. #14
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Re: Formula to count number of cells that are greater than the one before it

    that was in example of the correct answer if the data was. So the table (Items is a summary of the data
    .1 1
    .2 1
    .5 1)

    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.5 3
    0.5 3
    0.5 4
    0.5 4
    0.5 4

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula to count number of cells that are greater than the one before it

    I've fired off a help flare ... community help. I am too confused.

  16. #16
    Registered User
    Join Date
    06-26-2016
    Location
    New Zealand
    MS-Off Ver
    2016
    Posts
    8

    Re: Formula to count number of cells that are greater than the one before it

    haha, fair enough, ill summarize the problem.

    At the top of the excel spread sheet is a table that summaries the data.

    Probability Number of increase
    0.1 1
    0.2 1
    0.5 2

    Then there is the data below with 2 column. The probability and number column. I want a formula that automatically calculates the number of times a cell is greater than the one before it. With the help of this forum that has been achieved. But I also want to count the number of increases for each range of probabilities. So how many times is a cell bigger than the one before it when the probability is .1. How many when the probability is .02. In the example below the correct answer is that when the probability is .1 the answer is 1. Probability is .2 the answer is 1. And when the probability is .5 the answer is 2.

    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 0
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.1 1
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.2 2
    0.5 3
    0.5 3
    0.5 4
    0.5 4
    0.5 4

  17. #17
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Formula to count number of cells that are greater than the one before it

    This will give you the answers you want but I'm not convinced it's right!! Note you can put 0.1, 0.2 or 0.5 into D1 to get the appropriate result

    =SUMPRODUCT(--($B$1:$B$34<$B$2:$B$35),--(D1=$A$2:$A$35))

    I would have thought the number of changes for 0.1 was 2 not 1 and for 0.5 the answer was 1 change not 2 so the formula I would use is

    =SUMPRODUCT(--($B$1:$B$34<$B$2:$B$35),--(D1=$A$1:$A$34))
    Happy with my advice? Click on the * reputation button below

  18. #18
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Formula to count number of cells that are greater than the one before it

    Infact further to my last post I reckon this is the true formula which gives 1 change for 0.1, 0 changes for 0.2 and 1 change for 0.5

    =SUMPRODUCT(--($B$1:$B$34<$B$2:$B$35),--(D1=$A$1:$A$34),--(D1=$A$2:$A$35))

  19. #19
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Formula to count number of cells that are greater than the one before it

    What 's the purpose of all this ??



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 10-04-2015, 05:04 PM
  2. [SOLVED] Count Number of Cells in Col B that are greater than Col A
    By lordfa9 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2015, 04:44 AM
  3. [SOLVED] Count number of cells in range since last number greater than zero
    By whitfieldcraig in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-18-2015, 06:38 AM
  4. [SOLVED] How to count cells after last number greater than 0
    By gogreenpower in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-09-2014, 02:28 AM
  5. Replies: 6
    Last Post: 02-24-2012, 01:15 PM
  6. How to Count the Number of Cells Greater than Zero in a Filtered List?
    By denise001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2011, 11:33 AM
  7. Replies: 3
    Last Post: 05-19-2010, 04:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1