+ Reply to Thread
Results 1 to 23 of 23

IF <=0 INDEX MATCH LARGE otherwise return blank

  1. #1
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    IF <=0 INDEX MATCH LARGE otherwise return blank

    Hi,

    I have a nice little formula that does what I want but I can't get it to return nothing (blank) if it sees a value of 0 (zero) or below.

    Right now it returns everything even if 0 or below. I want to to be blank it it finds "<=0" so it would only return anything above a zero value.

    Here's my base formula.

    Please Login or Register  to view this content.
    Thanks for any help!

  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,885

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Wrap your existing statement in an IF-then statement.
    PHP Code: 
    =if(INDEX($B$1:$XR$1,MATCH(LARGE($B319:$XR319,COLUMN(A5)),$B319:$XR319,0))<=0,"",
    INDEX($B$1:$XR$1,MATCH(LARGE($B319:$XR319,COLUMN(A5)),$B319:$XR319,0))) 
    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 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,053

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Try:

    =if(INDEX($B$1:$XR$1,MATCH(LARGE($B319:$XR319,COLUMN(A5)),$B319:$XR319,0))<=0,"",INDEX($B$1:$XR$1,MATCH(LARGE($B319:$XR319,COLUMN(A5)),$B319:$XR319,0)))
    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

  4. #4
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Try

    =MAX(0,INDEX($B$1:$XR$1,MATCH(LARGE($B319:$XR319,COLUMN(A5)),$B319:$XR319,0)))

    and format cell as CUSTOM 0;;;@

    NOTE: the "blank" cells will still contain a value of 0 or less so this may be a problem if cells are used in other calculations.

  5. #5
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Thanks everyone. Unfortunately all the solutions are still returning the zeros.

    To make it easier to understand my use case, attached is a sample workbook with the formulas included and comments in the cells that should be blank.

    Sorry I should have included this in the first place.

    Thanks so much!
    Attached Files Attached Files

  6. #6
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    in M2

    =MAX(0,INDEX($B$2:$H$2,MATCH(LARGE($B7:$H7,COLUMN(D1)),$B7:$H7,0)))

    returns a value of 0.0001

    so M2=0(.0001) is correct

    Format cells in J2:M5 as number with 6 decimal places to see result.

  7. #7
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Maybe try

    =MAX(0,ROUND(INDEX($B2:$H2,MATCH(LARGE($B7:$H7,COLUMN(D1)),$B7:$H7,0)),3))

  8. #8
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Thank you that works. Unfortunately it doesn't return my LARGE first then the zeros. It returns whatever it sees first.

    e.g. B2=0 C2=0 D2=1... your solution will not return D2 first. It will return it last since it is in last place.

    My original formula returns largest first, second largest second, etc. (and makes concessions for a tie breaker) all the way down to 0. Yours seems to return in order found, disregarding the LARGE first order. I hope I'm making sense.

    Thanks again!

  9. #9
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Looks like your second formula works as intended! Thanks!

    I'll mess around with it and report back in a few mins.

  10. #10
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Thanks again John. It looks like it works.

    One last thing, for O-R I am trying to return the corresponding B1-H1. I can't seem to get there though.

    I tried this:

    HTML Code: 

  11. #11
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Try


    in O2 and copy across and down

    =IFERROR(INDEX($B$1:$H$1,,MATCH(J2,$B2:$H2,0)),"")

  12. #12
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Just spotted there are duplicate values (9) with different headers so the MATCH will only find the first header....

    So you need to find someway of differentiating duplicate values (repeated in row 5 with values of 5).

  13. #13
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Yea I saw that.... I have excel mind numb right now... I'll try later and post here if I find something that works.

    Adding rep for ya on the first solution. Cheers....

  14. #14
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    A "standard" way of addressing this problem is to add a small amount onto each result so we get (for example) 9.0001, 9.0002.

    This then throws the test for 0 out of the window !!!

  15. #15
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    A "standard" way of addressing this problem is to add a small amount onto each result so we get (for example) 9.0001, 9.0002.

    This then throws the test for 0 out of the window !!!

    I'll too will have think about how we might do this but will sign off for tonight (UK time!).

  16. #16
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    I'm back on this one.

    I think your idea might work on the headers but I'm not sure how I would apply a helper value along side text and return the header.

    Any help would be much appreciated.

  17. #17
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    I thought the file in Post #5 addressed the problem ????

  18. #18
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Yes, thank you, for the first part (return only values with no zeros, not duplicated)

    Post #11 onward refers to returning the header values from the results... headers are duplicating.

  19. #19
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Headers are not duplicated ... unless I completely mis-understand.

    Helper data in b7 onwards
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Looks like the spreadsheet you attached reflects my old formula of calculating this which returns zero values (I wanted to return everything but zero values - blank cells if zero).

    You proposed we use this formula instead for J2-M5:

    Please Login or Register  to view this content.
    Then format J2-M5 with this:

    Please Login or Register  to view this content.
    So that works well.

    However, I am having a hard time returning the corresponding header value from J1-M1 in O2-R5 while leaving zero values blank cells.

    Your proposed solution was this:

    Please Login or Register  to view this content.
    But that returned duplicates.

    Cheers!

  21. #21
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    The only way is do as you did originally with your formulas in B7:H10 as we have to have a unique value for each of the data in B2:H5 and using this in O2 onwards

    =INDEX($B$1:$H$1,MATCH(LARGE($B7:$H7,COLUMN(A1)),$B7:$H7,0))

    Using this in J2 etc will remove the 0s with the 0;;;@ formatting:

    =INT(INDEX($B2:$H2,MATCH(LARGE($B7:$H7,COLUMN(A1)),$B7:$H7,0)))
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    06-09-2014
    Location
    Hawaii
    MS-Off Ver
    Office 365
    Posts
    75

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Thanks for the help JohnTopley.

    I decided to use O2 onward as a helper and create a new table that doesn't return the zeros as follows - and it seems to work fine for the headers:

    Please Login or Register  to view this content.
    I can now build a new spreadsheet and bring in the results of the first helper table and second helper table.

    I think this is now solved.

    Again, thanks for hanging in there and helping on this.

  23. #23
    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,202

    Re: IF <=0 INDEX MATCH LARGE otherwise return blank

    Glad you have found a satisfactory solution.

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

+ 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. Index/ Match Formula, How to return blank cell as a blank not 0
    By MDResearcher in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-24-2016, 08:40 PM
  2. How to: Return next value w/ same # in index match large function?
    By Yoshi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2015, 02:35 AM
  3. [SOLVED] IF date value returned from Index/Match is blank, return prior cell that returns a value
    By gunnerau in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-11-2014, 08:40 PM
  4. Index/Match to return a blank cell
    By Nick_in_Dubai in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-26-2012, 06:36 AM
  5. INDEX, MATCH and LARGE
    By ridebikes in forum Excel General
    Replies: 1
    Last Post: 10-24-2011, 04:03 PM
  6. Replies: 2
    Last Post: 10-21-2011, 01:41 PM
  7. Index, Match, and Large
    By edwardpestian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2006, 06:10 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