+ Reply to Thread
Results 1 to 9 of 9

IF VLOOKUP LARGE combination

  1. #1
    Registered User
    Join Date
    07-07-2021
    Location
    Brisbane, Australia
    MS-Off Ver
    MS365
    Posts
    3

    IF VLOOKUP LARGE combination

    Hello brainstrust,

    First time poster so apologise for poor lingo.

    Looking for a formula(s) to return the 8 most recent non-blank values from a table where condition 'X' is met.

    Have been trying things like (for first, then third most recent ammonia result at location 1):
    {=IF(Table1[Sample Location] = 1, VLOOKUP(MAX(Table1[Date]), Table1[#All], 14, FALSE), "")}
    {=IF(Table1[Sample Location] = 1, VLOOKUP(LARGE(Table1[Date], 2), Table1[#All], 14, FALSE), "")}

    Date is in dd/mm/yyyy format.
    Max formula seems to work, but each subsequent rendition of large k is providing me the same output as the max?

    Appreciate your help! Please find a small section of the workbook attached.
    Attached Files Attached Files

  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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,836

    Re: IF VLOOKUP LARGE combination

    Is it MS365 that you have? If so, please update your forum profile.
    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
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,430

    Re: IF VLOOKUP LARGE combination

    There are multiple occurrences of 28/05/2021 so LARGE(Data,1), LARGE(date,2) will find the same value i.e 28/05/2021 AND VLOOKUP will simply find the first occurrence of this date so you will get the same value returned.

  4. #4
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,836

    Re: IF VLOOKUP LARGE combination

    Try this:

    =LOOKUP(2,1/((Table1[Sample Location]=$D$3)*(Table1[Date]=LARGE(IF(Table1[Sample Location]=$D$3,Table1[Date]),1))),Table1[Ammonia as N (mg/L)])

    and this:

    =LOOKUP(2,1/((Table1[Sample Location]=$D$3)*(Table1[Date]=LARGE(IF(Table1[Sample Location]=$D$3,Table1[Date]),2))),Table1[Ammonia as N (mg/L)])

    etc.

  5. #5
    Registered User
    Join Date
    07-07-2021
    Location
    Brisbane, Australia
    MS-Off Ver
    MS365
    Posts
    3

    Re: IF VLOOKUP LARGE combination

    Thankyou Ali!!! You are a gem.

  6. #6
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,836

    Re: IF VLOOKUP LARGE combination

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  7. #7
    Registered User
    Join Date
    07-07-2021
    Location
    Brisbane, Australia
    MS-Off Ver
    MS365
    Posts
    3

    Re: IF VLOOKUP LARGE combination

    G'day brainstrust,

    Wondering if its possible to build on Ali's formula '=LOOKUP(2,1/((Table1[Sample Location]=$D$3)*(Table1[Date]=LARGE(IF(Table1[Sample Location]=$D$3,Table1[Date]),1))),Table1[Ammonia as N (mg/L)])' to return an average for a sample location within a given date range, e.g. annual average of ammonia for sample location $D$3 for the year 2021.

    Alternatively, can the formula be amended to return a single value from within a date range, i.e. ...(Table1[Date]>01/01/2021<31/01/2021) to return the single recorded value from within January 2021.

    Appreciate your help.

    Jack.

  8. #8
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,880

    Re: IF VLOOKUP LARGE combination

    BTW, another option for your original question since you're using 365 is to put this formula in cell D5. It will "SPILL" across the most recent 8 (no need to copy the formula across.

    It also allows you to have the same name as the Headers on "Data" tab down the Quality Characteric column so you can just copy down the formula.

    Please Login or Register  to view this content.
    I've attached a sample.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,880

    Re: IF VLOOKUP LARGE combination

    To get an average over a data range, for a location, for a characteristic, try this (it assumes the "start date" is in cell M3 and "end date" is in cell N3):

    Please Login or Register  to view this content.
    To display the values recorded within a date range, you could try this (assumes the same cells for the date range):

    =INDEX(FILTER(Table1,(Table1[Sample Location]=$D$3)*(Table1[Date]>=$M$3)*(Table1[Date]<=$N$3)),,MATCH($B5,Table1[#Headers],0))

    See attached.
    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. IF-AND-OR-VLOOKUP Combination
    By sammymalta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-13-2018, 08:07 AM
  2. [SOLVED] =SUM Combination In Order To Find Specific Value For Large Amount of Data
    By KMVKMVKMV in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-02-2017, 04:17 PM
  3. [SOLVED] IF(AND(SMALL(LARGE Combination Help
    By chad328 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-30-2016, 07:03 AM
  4. Replies: 2
    Last Post: 11-24-2014, 11:37 AM
  5. Combination Macro for =LARGE & INDEX/MATCH
    By mabeaver in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2012, 02:16 PM
  6. Problem Using VLOOKUP and LARGE combination
    By pablote11 in forum Excel General
    Replies: 1
    Last Post: 03-26-2010, 12:17 PM
  7. Using INDEX/MATCH in combination with LARGE?
    By scoobz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2008, 02:38 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