Results 1 to 4 of 4

Complex formula to multi-extract smallest and largest date in various ranges

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-25-2015
    Location
    London
    MS-Off Ver
    MS 365
    Posts
    215

    Question Complex formula to multi-extract smallest and largest date in various ranges

    Hi all,

    I have a bit of a complex problem to solve...not even ChatGPT was able to handle :D

    Bit of a description (all in an Excel table):

    1) Cells in range C12:C111 can have one of the following three values: Stage, Task or Milestone
    2) Range M12:M111 contains start dates, but only shows where the respective cell in column C is Task or Milestone
    3) Range N12:N111 contains end dates, but only shows where the respective cell in column C is Task or Milestone
    4) I want to extract the earliest (min) as well as the latest (max) date from the two date ranges for all Task or Milestone values between the Stages. Example:


    C12 = Stage, C13 = Milestone or Task, C14 = Milestone or Task, C15 = Stage, C16 = Milestone or Task, C17 = Milestone or Task, C18 = Milestone or Task, C19 = Milestone or Task, C20 = Stage....
    In this case, the expected outputs in M12 would be the earliest date of range M13:M14, the expected output in N12 would be the latest date of range N13:N14, the expected output in M15 would be the earliest date of range M16:M19 and the expected output in N15 would be the latest date of range N16:N19 and so on.

    The complexity is that new rows can be added at any point in time (as said, it's in an Excel table) so the formulae need to be so dynamic to identify where all the stages are and calculate the in-between min and max dates for each stage that occurs. Hope that makes sense...

    Attached is a screenshot of what I am trying to achieve...

    This is what ChatGPT recommended, but it returns 0 (indicated as Sat, Jan 00 1900 in screenshot) for when the respective value in column C is "Stage"...

    Min Date:

    
    =IF(C12="Stage", IFERROR(MIN(IF((ROW(C$13:C$112)<IFERROR(MATCH("Stage", C$13:C$112, 0)+ROW(C12), ROW(C$112)+1))*(ROW(C$13:C$112)>ROW(C12))*(C$13:C$112<>"Stage"), M$13:M$112)), ""),
    
    ---this bit can be ignored as working already----
    IF($L12<>"",
    WORKDAY($L12-1,1,),
    IF(AND($J12<>"",$K12<>""),
    WORKDAY(
    INDEX($N$12:$N$113,MATCH($J12,$B$12:$B$113,0))-1,
    1,),"")))
    Max Date:

    
    =IF(C12="Stage", IFERROR(MAX(IF((ROW(C$13:C$112)<IFERROR(MATCH("Stage", C$13:C$112, 0)+ROW(C12), ROW(C$112)+1))*(ROW(C$13:C$112)>ROW(C12))*(C$13:C$112<>"Stage"), N$13:N$112)), ""),
    
    ---this bit can be ignored as working already----
    IF($C12=Settings!$B$8,$M12,IF(AND($M12<>"",$K12<>""),WORKDAY($M12-1,$K12,FILTER(Settings!$J$6:$J$506,Settings!$J$6:$J$506<>"")),"")))
    Sadly can't share the actual file as contains confidential data I can't easily strip out, sorry.

    Any smart folks out there who can help solve this problem? Thanks so much!
    Attached Images Attached Images
    Last edited by kingofcamden; 05-23-2024 at 08:47 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Extract Largest and Smallest Items with Conditions
    By andrewc in forum Excel General
    Replies: 4
    Last Post: 04-06-2020, 02:26 PM
  2. Largest positive & Smallest negative with multi conditions
    By bittubadri in forum Excel General
    Replies: 15
    Last Post: 11-11-2019, 05:19 AM
  3. [SOLVED] how to extract the smallest and largest numbers
    By rcahayag1925 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-02-2019, 11:54 PM
  4. Replies: 7
    Last Post: 06-20-2016, 08:37 AM
  5. Segregating entries by date and then by smallest/largest purchase
    By Trillium15 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2015, 11:27 AM
  6. [SOLVED] Extract largest or smallest value from a CELL
    By brad999 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-09-2013, 04:49 AM
  7. [SOLVED] Formula to extract top largest to smallest amount based on 3 criterias
    By aurisab in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-26-2013, 08:05 AM

Tags for this Thread

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