+ Reply to Thread
Results 1 to 6 of 6

calculate X days high and low based on a sequence of values

  1. #1
    Registered User
    Join Date
    09-19-2023
    Location
    usa
    MS-Off Ver
    office2021
    Posts
    2

    calculate X days high and low based on a sequence of values

    How to loop through excel table to find X days high and X days low. (X here is a variable)

    For example:

    If today's value is >= yesterday's value than +1 till find today's value < value.

    I don't think formula will work, because it will need to loop through each date to find the X variable.


    thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: calculate X days high and low based on a sequence of values

    I cannot replicate your answer with my code. Not sure how you arrived at those numbers.
    For High, here is my code. For low, change the If then formula to be less vs more

    Please Login or Register  to view this content.
    Also, move your low to a different sheet or this will not work.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,894

    Re: calculate X days high and low based on a sequence of values

    I believe your X days low for nameB is wrong. Should it not be 5? As 4/13/2024 is lower than 46.55.

    At any rate, you could use formula.
    For x days high. Copy down.
    Please Login or Register  to view this content.
    For x days low. Copy down.
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: calculate X days high and low based on a sequence of values

    B3, high:

    Please Login or Register  to view this content.
    copy to B11, low, change > with <

    Please Login or Register  to view this content.
    Quang PT

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,894

    Re: calculate X days high and low based on a sequence of values

    Right, in my pursuit of trying to use LAMBDA, REDUCE etc to initially solve the problem I had forgotten that I didn't need extra steps

  6. #6
    Registered User
    Join Date
    09-19-2023
    Location
    usa
    MS-Off Ver
    office2021
    Posts
    2

    Re: calculate X days high and low based on a sequence of values

    Thanks everyone for the help, really appreciated. Didn't know that Match could use this way.

+ 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. [SOLVED] How to calculate task schedule based on 4-days work and 4-days OFF including weekends
    By qadeerume in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-28-2020, 12:19 AM
  2. Autofill dates based on a sequence of days
    By ic31420 in forum Excel General
    Replies: 4
    Last Post: 09-28-2018, 05:06 PM
  3. Replies: 17
    Last Post: 08-14-2018, 05:10 AM
  4. [SOLVED] calculate total number of days between two days based on 365 days year
    By aparunkumar in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-14-2016, 12:51 AM
  5. Replies: 0
    Last Post: 06-11-2015, 03:12 AM
  6. Copy X Number of Rows Based on Checkbox, and Calculate High Point?
    By djpony in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2011, 05:01 PM
  7. Replies: 4
    Last Post: 01-18-2011, 10:47 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