+ Reply to Thread
Results 1 to 7 of 7

Formula to return text based on two criteria

  1. #1
    Forum Contributor
    Join Date
    11-01-2014
    Location
    London, England
    MS-Off Ver
    Mac 2016
    Posts
    108

    Formula to return text based on two criteria

    Hi

    I need a formula to bring back a cost based on a date and category. The categories have two costs between a different range of dates. I have attached an example to help explain.

    I tried =lookup formula but it didn't work, it seemed to stop at the first cost amount from the category it found.

    I would appreciate any help.

    Thanks

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Formula to return text based on two criteria

    Presuming there is no overlap, you could use a SUMIFS. Since it would only find 1 entry the "SUM" would be the same thus pulling your value.

    Alternatively, and likely more complicated, you could potentially use a multi condition lookup. This is usually something like INDEX(MATCH and then concatenate the MATCH lookup values and ranges. However this is compunded by wanting to look for a date between others, not an exact date.

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Formula to return text based on two criteria

    Try these:

    B4 =SUMIFS(D8:D15,B8:B15,"<="&B2,C8:C15,">="&B2,A8:A15,B3)
    F4 =SUMIFS(D8:D15,B8:B15,"<="&F2,C8:C15,">="&F2,A8:A15,F3)

  4. #4
    Forum Contributor
    Join Date
    11-01-2014
    Location
    London, England
    MS-Off Ver
    Mac 2016
    Posts
    108

    Re: Formula to return text based on two criteria

    Thank you 63falcondude, that works perfectly.

  5. #5
    Forum Contributor
    Join Date
    11-01-2014
    Location
    London, England
    MS-Off Ver
    Mac 2016
    Posts
    108

    Re: Formula to return text based on two criteria

    Thanks Zer0Cool

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Formula to return text based on two criteria

    You're welcome. Thanks for the rep!

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

    Re: Formula to return text based on two criteria

    Try this array formula inB4.. and a variant in the other cell. However, i'm not convinced that your example is represenatative, so more work may be needed:

    =INDEX($D$8:$D$15,MATCH(1,($B$2>=$B$8:$B$15)*(B2<=$C$8:$C$15)*($A$8:$A$15=$B$3),0))

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    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

+ 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: 3
    Last Post: 12-03-2014, 05:43 PM
  2. [SOLVED] Return Text based on criteria
    By shido in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-04-2013, 07:19 PM
  3. [SOLVED] Return Text based on criteria
    By shido in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-04-2013, 04:08 PM
  4. [SOLVED] Formula to return specific text based on multiple cells meeting a single criteria
    By missydanni in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2013, 09:48 AM
  5. [SOLVED] Return Text if True based on multiple criteria
    By JonnyMa in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-21-2013, 06:57 PM
  6. Return a Text Value based on criteria
    By SeanKosmann in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-26-2010, 04:08 PM
  7. Return text based on criteria
    By PearlJam in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-02-2009, 08:58 AM

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