+ Reply to Thread
Results 1 to 10 of 10

Get largest value from a list with at least 2 entries

  1. #1
    Registered User
    Join Date
    02-09-2023
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Get largest value from a list with at least 2 entries

    I have table with consecutive counting months and days and I use the LINEST function to calculate the linear regression of the latest month but it doesn't work very well when a month have only one entry. This is the reason why I'm looking for a way to get the largest value from a list (the months) but only if it has at least two points (two enrties).
    Here something more concrete, the table looks like something like this one:
    Month Day Value
    2 33 20
    2 45 24
    2 54 27
    3 65 30
    3 78 35
    3 87 39
    4 92 45

    I use the LINEST function with the FILTER function to calculate the linear regression of the last month.

    Please Login or Register  to view this content.
    With this formula the LINEST function returns for the 4th month the values 0 and 45, what actually a quite useless linear regression is.
    In this case I would like to have the linear regression still starting from the 3rd month although there is already a entry in the 4th month.

    What I'm looking for is to replace the
    Please Login or Register  to view this content.
    with a formula which returns 3 instead of 4 if there is only one entry for the largest value.

    Thanks in advance
    Attached Files Attached Files
    Last edited by Whoops; 05-04-2023 at 06:54 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Get largest value from a list with at least 2 entries

    If you are using FILTER then you are no longer using Excel 2016 - what are you using now? Please update your profile.

    Is this substantially different to your previous thread?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Get largest value from a list with at least 2 entries

    Can you post an excelfile instead of an formula ?
    It'll be a compounded "aggregate"-formula
    Last edited by bsalv; 05-04-2023 at 06:50 AM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  4. #4
    Registered User
    Join Date
    02-09-2023
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Get largest value from a list with at least 2 entries

    So nobody has an idea how to achieve it?

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Get largest value from a list with at least 2 entries

    We've been waiting for you to confirm your Excel version!

    Now that you have, can you please tell us the results (values) that you would want returning in the sample workbook?

    A also asked you if this question is substantially different to your prevous thread - you need to respond to a moderator's questions, please.

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Get largest value from a list with at least 2 entries

    I guest what you want is

    =LINEST(BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Value]))),BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Day]))))

  7. #7
    Registered User
    Join Date
    02-09-2023
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Get largest value from a list with at least 2 entries

    Well I changed my Excel version to 365. Anyway I found another way to achieve what I wanted, I just get the month of the 3rd last row of the table
    Please Login or Register  to view this content.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Get largest value from a list with at least 2 entries

    OK - thanks for letting us know.

    Please close the thread by marking it as solved. Thanks.

  9. #9
    Registered User
    Join Date
    02-09-2023
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Get largest value from a list with at least 2 entries

    Quote Originally Posted by windknife View Post
    I guest what you want is

    =LINEST(BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Value]))),BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Day]))))
    Thanks for the reply but it is not what I was looking for. I tested the formula and it returns only the last entry of each month.

    BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Value]))) BYROW(UNIQUE(Table[Month]),LAMBDA(x,MAX((Table[Month]=x)*Table[Day])))
    27 54
    39 87
    45 92

    My objective was to have a meaningful linear regression of the current month, but if the current month has only one point, it has to return the linear regression of the previous month + current month

    In this example it should have used the month 3 and 4

    FILTER(Table[Value],Table[Month]>=INDEX(TABLE[Month],ROWS(TABLE)-3)) FILTER(Table[Day],Table[Month]>=INDEX(TABLE[Month],ROWS(TABLE)-3))
    30 65
    35 78
    39 87
    45 92

  10. #10
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Get largest value from a list with at least 2 entries

    Please Login or Register  to view this content.
    Edit : i modified my post !
    Attached Files Attached Files
    Last edited by bsalv; 05-05-2023 at 11:48 AM.

+ 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: 10
    Last Post: 08-04-2020, 01:19 PM
  2. Replies: 1
    Last Post: 11-27-2017, 08:50 PM
  3. Lookup largest, 2nd largest...value by subgroup from a list
    By pvp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-25-2017, 09:12 AM
  4. 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
  5. Replies: 3
    Last Post: 12-11-2014, 12:04 PM
  6. Using VBA: I have a list with multiple entries.Need to reduce down to unique entries
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-25-2011, 03:19 PM
  7. Recording Daily numerical entries by largest
    By pajo60 in forum Excel General
    Replies: 3
    Last Post: 09-10-2009, 10:22 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