+ Reply to Thread
Results 1 to 8 of 8

Count how many days to drop from maximum value into 0

  1. #1
    Forum Contributor
    Join Date
    12-09-2022
    Location
    Australia
    MS-Off Ver
    365
    Posts
    103

    Count how many days to drop from maximum value into 0

    Hi
    Please can you help me .
    My spreadsheet is like this (please see the attached):

    1. Column A : Dates (Every day's Date):
    2. Column B : Data numbers (daily value)
    3. Column E-F: Is where I want the formula to be: Determine the number of days from when maximum value drop to zero

    For example, on Dec 5 2026, the maximum value is 23.11, and then it starts to getting smaller until 0 on Dec 8 2026. By this i have roughly 3 days in 2026. It is similar to 2027 that i have 3 days to drop from maximum value into 0


    The formula must look at every in-Column A and the corresponding data in column B and generate the outputs as indicated from column E-F.

    Many thanks
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count how many days to drop from maximum value into 0

    This formula works. There may be a more efficient or shorter one.

    =LET(Pos,MATCH(E2&MAXIFS(B:B,A:A,">="&DATE(E2,1,1),A:A,"<="&DATE(E2,12,31)),YEAR(A:A)&B:B,0),MATCH(0,INDEX(B:B,Pos+2):INDEX(B:B,Pos+365),0))
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    12-09-2022
    Location
    Australia
    MS-Off Ver
    365
    Posts
    103

    Re: Count how many days to drop from maximum value into 0

    Many Thanks

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count how many days to drop from maximum value into 0

    It just occurred to me that this formula assumes that that the number must be at least 1. Here is a revision that works if the very next number after the max is 0. Also this formula adds absolute addressing so it is moveable.

    =LET(Pos,MATCH($E2&MAXIFS($B:$B,$A:$A,">="&DATE(E2,1,1),$A:$A,"<="&DATE($E2,12,31)),YEAR($A:$A)&$B:$B,0),MATCH(0,INDEX($B:$B,Pos+1):INDEX($B:$B,Pos+365),0)-1)

  5. #5
    Forum Contributor
    Join Date
    12-09-2022
    Location
    Australia
    MS-Off Ver
    365
    Posts
    103

    Re: Count how many days to drop from maximum value into 0

    Thanks for clarification. I was wondering if i want to count how many days to drop from maximum value into certain threshold. For example, 5. if there anyway i can modify your suggested formular?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count how many days to drop from maximum value into 0

    A bit harder, because looking for 0 is an exact match. I'll see if I can look into it.

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: Count how many days to drop from maximum value into 0

    i want to count how many days to drop from maximum value into certain threshold. For example, 5
    I'm not sure I understand you correctly. Can you give an example of this in a sample sheet?

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Count how many days to drop from maximum value into 0

    This adjustment will look for the number of values following the maximum until it reaches 5 or less. Changes from the original formula are highlighted. The 5 can be replaced with a cell reference if desired.

    =LET(Pos,MATCH($E2&MAXIFS($B:$B,$A:$A,">="&DATE(E2,1,1),$A:$A,"<="&DATE($E2,12,31)),YEAR($A:$A)&$B:$B,0),MATCH(5,INDEX($B:$B,Pos+1):INDEX($B:$B,Pos+365),-1))

+ 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: 09-18-2022, 06:00 PM
  2. [SOLVED] How to find the maximum value of the last 6 consecutive days without spaces?
    By rayhen in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-22-2020, 11:09 PM
  3. Finding maximum number of consecutive days
    By loumarday in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-20-2019, 11:06 AM
  4. [SOLVED] Pendency as per maximum no of days
    By vshukla in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-13-2014, 08:43 AM
  5. Counting Maximum Consecutive Days
    By Delleeb in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-26-2013, 03:51 PM
  6. Replies: 3
    Last Post: 08-19-2011, 10:32 AM
  7. [SOLVED] maximum days in a month
    By james in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-07-2005, 11:06 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