+ Reply to Thread
Results 1 to 15 of 15

Find median between 2 dates and product

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Question Find median between 2 dates and product

    Hi all,

    i have a problem solving this problem, i have the following example data:

    Apple Banana Orange
    01-10-2022 10 20 5
    01-11-2022 12 23 6
    01-12-2022 14 24 7
    01-01-2023 16 25 8
    01-02-2023 18 26 9
    01-03-2023 20 27 10
    01-04-2023 22 28 11
    01-05-2023 24 29 12
    01-06-2023 26 30 13
    01-07-2023 28 31 14
    01-08-2023 30 32 15

    I would like 2 have a lookup where i can choose a product and a startdate and number of month and then get a median, something like this:


    Example 1
    Product Startdate number of months Median
    Apple 01-11-2022 3 14

    I have tried with median if, but no luck.??
    Attached Files Attached Files

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Find median between 2 dates and product

    How do you know number of months?

  3. #3
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Re: Find median between 2 dates and product

    They are manuelly entered and can be different every time, it is meant so that the user dont see the data - but in a list choose product - date and number of month,
    i hope that make sense.

  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 2403
    Posts
    44,063

    Re: Find median between 2 dates and product

    I have interpreted your request (given your expected answer) as meaning 1/11/22 is the first month of 3.

    MEDIAN(INDEX(INDEX($F$6:$H$16,,MATCH(L7,$F$5:$H$5,0)),MATCH(L6,$E$6:$E$16,0)):INDEX(INDEX($F$6:$H$16,,MATCH(L7,$F$5:$H$5,0)),MATCH(L6,$E$6:$E$16,0)+L8-1))

    But... this can be simplified.


    Is your forum profile showing the Excel PRODUCT that you need this request to work with?

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Cheers,

    Glenn.
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

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

    Re: Find median between 2 dates and product

    If you have O365 and you have an up to date version of it:

    =LET(D,E6:E16,V,FILTER(F6:H16,F5:H5=L7),MEDIAN(TAKE(FILTER(V,D>=L6),L8)))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Re: Find median between 2 dates and product

    Hi Glenn,

    sorry about the old information, i have updated my profile - are runnge O 365 Version 2211- i will go test your suggestion

  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 2403
    Posts
    44,063

    Re: Find median between 2 dates and product

    OK. It should be OK... assuming my earlier assumption was correct.

  8. #8
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Thumbs up Re: Find median between 2 dates and product

    It worked perfect - thank you very much

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

    Re: Find median between 2 dates and product

    I just noticed that the use of LET is redundant:

    =MEDIAN(TAKE(FILTER(FILTER(F6:H16,F5:H5=L7),E6:E16>=L6),L8))

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    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.

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

    Re: Find median between 2 dates and product

    Another option:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Re: Find median between 2 dates and product

    I have tried with some more accurate data but i the median isn't correct, i can't see whats wrong ?
    Attached Files Attached Files

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

    Re: Find median between 2 dates and product

    The median value (2nd highest or 2nd lowest) looks correct.
    Which value did you expected and why?
    Attached Images Attached Images

  13. #13
    Registered User
    Join Date
    06-06-2013
    Location
    Denmark
    MS-Off Ver
    Office 365 Version 2211
    Posts
    6

    Re: Find median between 2 dates and product

    sorry - that was my mistake, i got the meaning of Median wrong, it should have been AVERAGE, i have changed it and it's working

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

    Re: Find median between 2 dates and product

    Good to hear you solved the last one yourself.

    Thanks for the feedback. Glad to have helped.

    Please considder adding reputation to the answer(s) of any helpers, which you think they deserved because of the help they have provided.
    If you want to, please click on * Add reputation left below their answers.

  15. #15
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Find median between 2 dates and product

    j28=IFERROR(AGGREGATE(16,6,INDEX($F$6:$H$16,,MATCH($G28,$F$5:$H$5,0))/($E$6:$E$16>=$H28)/($E$6:$E$16<EDATE($H28,3)),0.5),"")

    copy down
    Attached Files Attached Files

+ 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. Find Key Word, Then Find Min, Max & Median Values
    By mycon73 in forum Excel General
    Replies: 16
    Last Post: 03-21-2016, 02:06 AM
  2. Replies: 6
    Last Post: 02-21-2016, 04:15 AM
  3. Median Indirect: Find median in range and bring back adjacent cells
    By Keelin in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 06-27-2014, 08:31 AM
  4. [SOLVED] Median Ifs, need to find median $ amount per deal for each year
    By xenomorph8472 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-13-2012, 02:01 PM
  5. [SOLVED] Find Product Details in Another Sheet based on Product ID and Copy some Fields From there
    By kevalkothari in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-29-2012, 10:43 AM
  6. [SOLVED] Need Function that will find ordered product, and display the product code in a 2nd workbk
    By rollerden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2012, 08:52 AM
  7. How do find Median of a set of totals and find the relating grade
    By whitespaces in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2006, 11:16 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