+ Reply to Thread
Results 1 to 9 of 9

Syntax for LARGE with criteria using OR

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Syntax for LARGE with criteria using OR

    Hi,
    I have column M with security type and column N with percentages. My goal is to get the largest, second-largest, etc. percentage if the security type is Equity or Fixed. I tried a lot of variations but cannot get it to work. Here's one of the things I tried:

    =LARGE(IF($M$30:$M$500=OR("Equity","Fixed")),$N$30:$N$500),1)

    Any help would be appreciated.
    Thanks,
    Phillycheese
    Last edited by Phillycheese5; 11-21-2014 at 02:52 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,320

    Re: Syntax for LARGE with criteria using OR

    Formula: copy to clipboard
    =IFERROR(LARGE(IF($M$30:$M$500={"Equity","Fixed"},$N$30:$N$500),ROW(A1)),"")
    Array Entered with Ctrl-Shift -Enter rather than just Enter.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Syntax for LARGE with criteria using OR

    Try this ARRAY, adjusted for your ranges...
    =LARGE(IF($B$1:$B$18={"equity","fixed"},$A$1:$A$18,0),ROW(A1))

    edit: Is there an echo in here, Trevor?
    Last edited by FDibbins; 11-21-2014 at 02:36 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Syntax for LARGE with criteria using OR

    This regular formula returns the nth largest value where the corresponding type is Fixed or Equity
    =LARGE(INDEX(($M$30:$M$500={"Equity","Fixed"})*$N$30:$N$500,0),1)
    Replace the 1 with whichever largest value you want the formula to return.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,320

    Re: Syntax for LARGE with criteria using OR

    Slight amendment for Ron's solution:

    Formula: copy to clipboard
    =LARGE(INDEX(($M$30:$M$500={"Equity","Fixed"})*$N$30:$N$500,0),ROW(A1))



    Regards, TMS

  6. #6
    Forum Contributor
    Join Date
    06-10-2005
    MS-Off Ver
    2007
    Posts
    223

    Re: Syntax for LARGE with criteria using OR

    These are great solutions!!! Thank you Ron and TMS!!

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Syntax for LARGE with criteria using OR

    Glad you got something you can use!

    ...and thanks for the feedback. Much appreciated.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,320

    Re: Syntax for LARGE with criteria using OR

    @Phillycheese5: You're welcome. Thanks for the rep.

    @Ford: the IFERROR had faded in your post

    @Ron: I prefer your solution as I prefer to avoid array solutions ... too easy to forget to press all the right keys.

    Regards all, TMS

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Syntax for LARGE with criteria using OR

    Here's another one if you're using Excel 2010 or later...

    =AGGREGATE(14,6,$N$30:$N$500/($M$30:$M$500={"Equity","Fixed"}),1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. use large function with sum criteria
    By rishikrsaw in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-24-2014, 05:00 PM
  2. Match with Muliple Criteria VBA Syntax Issue
    By beat in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-23-2013, 09:13 AM
  3. Large function with if criteria
    By ronleex324 in forum Excel General
    Replies: 6
    Last Post: 03-20-2009, 02:30 PM
  4. DCOUNT-criteria syntax for counting blank cells
    By onin111 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2008, 06:37 AM
  5. Syntax for IF with multiple criteria
    By SueJB in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-20-2005, 02:47 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