+ Reply to Thread
Results 1 to 20 of 20

Counting new record years correctly

  1. #1
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Counting new record years correctly

    See attachment.

    2 issues.

    1. The formula counts J2 as a new record year even if there was no dividend paid any previous years. I want to start to count on K2 instead as this is the first year it records a year that has a higher number than the previous year.

    2. It counts L2 as a new record year even if it was L1 was identical in value as K1. I want it to only count if the next number is higher than the previous number AND higher than the previous highest number in the dataset.

    Example of dataset:

    Year: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10
    Dividend: 0 - 1 - 2 - 3 - 4 - 3 - 5 - 6 - 7 - 7
    Number of years of new record dividend: 1 - 2 - 3 - - 4 - 5 - So this should be counted as 5 new years of record dividend.

    Hope this helps.

    The current formula I use now for Number of years of new record dividend is =IF(MAX($B158:J$158)=J158;MAX($A159:I$159)+1;"")
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,906

    Re: Counting new record years correctly

    I want it to only count if the next number is higher than the previous number AND higher than the previous highest number in the dataset.
    You don't need the portion before the AND, since if the second part is correct, "higher than the previous highest number in the dataset" means it will be higher than the previous by default.

    In your example in your description (not your attachment), you're saying you don't want to count year 2 as the highest even though 1 is greater than 0, right? Even if this is correct, you're only showing 5 new years of record dividend. Why isn't it 6? To me it seems that years 3,4,5,7,8,9 (6 years) all have new highs.

    Under your first year, you don't need a formula as this will never be a number. Therefore under your second year, you can use what you have but change the first range to one cell BEFORE your current cell, and use < instead of =. For instance, try this where your formula above is (then copy across to all years but year 1).

    (changes in RED)

    =IF(MAX($B158:I$158)<J158;MAX($A159:I$159)+1;"")

  3. #3
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Thanks. You are absolutely correct. My mistake.

    In the dataset above I want it to be recorded 6 years of record dividends. Starting to count at year 3 in this example. The increase from 1 to 2. If year number 1 had a number higher than 0 and year 2 dividend was higher than year 1 dividend, I would want it to start to count a new record year at year 2.

    I tried you formula but it didn't work. I think I did something wrong in the "dividend" attachment. I tried to adjust your formula to my cell, because with your formula it was covering too many cells that I was not using etc..

    So I will attach another excel file with a dataset and my modification of your formula. Can you please see what is wrong? Thanks.
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    Are you still using excel 2016? If not please amend your profile... or confirm that you are still using 2016.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    ? I use 2013, which is written in my profile

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    Apols... I meant 2013!! Not enough coffee onboard yet!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    ?? c12, copied across. refer to the file.

    =IF(C8>MAX($B8:B8),MAX($B12:B12)+1,"")
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,906

    Re: Counting new record years correctly

    Since you say that you don't want to show an increase in year 2 if year 1 is 0 or blank, the only thing I would add to Glenn's formula is an IF to check that:

    =IF($B$8=0,"",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

  9. #9
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Quote Originally Posted by Glenn Kennedy View Post
    ?? c12, copied across. refer to the file.

    =IF(C8>MAX($B8:B8),MAX($B12:B12)+1,"")
    This formula works. Thanks!

  10. #10
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Quote Originally Posted by Gregb11 View Post
    Since you say that you don't want to show an increase in year 2 if year 1 is 0 or blank, the only thing I would add to Glenn's formula is an IF to check that:

    =IF($B$8=0,"",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))
    Ufortunately when I use your formula and drag it out it only gives me blank cells for the whole dataset.

  11. #11
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,906

    Re: Counting new record years correctly

    That's because I put an anchor on the cell and shouldn't have. Should have been:

    =IF(B8=0,"",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

    This assumes that once you start having dividends, it never goes to 0.

  12. #12
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Quote Originally Posted by Gregb11 View Post
    That's because I put an anchor on the cell and shouldn't have. Should have been:

    =IF(B8=0,"",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

    This assumes that once you start having dividends, it never goes to 0.
    Now it worked. However it might be that there will be a year with 0 in dividends. (after some year with dividends) Then I noticed it didn't count the next year with 5 in dividends as a new record year.
    Is it possible with a solution for that scenario?

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    You're welcome. Thanks for letting us know that you got an answer.




    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  14. #14
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,906

    Re: Counting new record years correctly

    @stockman,

    Then use this:

    =IF(B8="","",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

  15. #15
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    This works when the first cell is blank.
    If there is a 0 in the cell it counts already the first number after that as a new record year.
    Actually in my case no dividend will be market with a ––
    So how to not make it count the first number after either a blank, 0 and -- ?

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    Stockman... who are you talking to? If you don't say.. we can't tell!






    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  17. #17
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Quote Originally Posted by Glenn Kennedy View Post
    Stockman... who are you talking to? If you don't say.. we can't tell!






    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.
    Sorry. The message was a reply to @Gregb11

  18. #18
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,906

    Re: Counting new record years correctly

    I think you should use this then:

    =IF(B8="––","",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

    And always mark where no dividend offered with "––"

    You can't say if there is a 0 not to count it because in Post #12 you said to count if prior year 0. It needs a way to differentiate between a dividend of 0, and no dividends offered.

    Pick a method to differentiate it and stick with it. If you want to include blanks as well, then try this:

    =IF(OR(B8="––",B8=""),"",IF(C8>MAX($B8:B8),MAX($B12:B12)+1,""))

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,470

    Re: Counting new record years correctly

    Stockman - was there a problem with the formula that I suggested? It was not clear from your previous replies.

  20. #20
    Registered User
    Join Date
    04-15-2016
    Location
    Oslo
    MS-Off Ver
    Excel 2013
    Posts
    79

    Re: Counting new record years correctly

    Glenn,

    Apologies. It was that it began to count the first positive year of dividend as a new record year when the first year was 0 or blank. I wanted it not to count unless the first number was a positive number.

    However after thinking about it for some time I rather want to go with the original solution that you have. That it counts the first positive year as a new record year.

    So I consider the case solved. Thanks you very much for your help both of you!

+ 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. COUNT is not Counting Correctly
    By CNL1982 in forum Excel General
    Replies: 1
    Last Post: 05-11-2024, 12:45 AM
  2. [SOLVED] Counting this years payments
    By treydawgmt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-18-2021, 02:11 AM
  3. Excel macros in Mac do not record correctly
    By tallapek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2020, 09:18 AM
  4. Counting months by years!
    By Maria.g in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-23-2013, 10:16 AM
  5. Counting weeks in years
    By initias in forum Excel General
    Replies: 13
    Last Post: 11-15-2010, 09:48 AM
  6. Counting years in Cells
    By whatsmyname in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-06-2010, 11:17 AM
  7. Counting years
    By traceya in forum Excel General
    Replies: 4
    Last Post: 09-30-2009, 10:39 AM

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