+ Reply to Thread
Results 1 to 8 of 8

Multiple criteria (finding closest)

  1. #1
    Registered User
    Join Date
    06-07-2009
    Location
    london, england
    MS-Off Ver
    excel 2010
    Posts
    36

    Multiple criteria (finding closest)

    Hi. I hope you can help.

    I would like to determine the price that is valid on a given date:

    Product Client Date Price
    Product A Client 1 1/1/13 10.00
    Product A Client 1 1/3/13 10.50
    Product A Client 1 1/6/13 11.00
    Product A Client 2 1/1/13 10.00
    Product B
    Product B
    Product B

    In this case, let us say that the Product is in Column A, Client in Column B and so on. I want to built another table which looks at the price by date:

    So it might be:


    27/2/13 10.00
    28/2/13 10.00
    1/3/13/ 10.50

    and so on. Could someone help me with the formula such that it isn't too slow and there will be a lot of dates and products.

    Thanks a lot.
    James

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Multiple criteria (finding closest)

    What is your expected output when there's more than one of the same date in your data source?

  3. #3
    Registered User
    Join Date
    06-07-2009
    Location
    london, england
    MS-Off Ver
    excel 2010
    Posts
    36

    Re: Multiple criteria (finding closest)

    There shouldn't be more than one combination of product of product, customer and date. If there is no date available for that period is should return an error if possible. so in this example, is there is a date for 2012 then there would be no valid date.

    Thanks for your help.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Multiple criteria (finding closest)

    Your second table doesn't have product or customer identified as a criteria.

    If you simply listed dates in your 2nd table, and looked up only matches for dates you would find the first and fourth lines from the data source that both match.

    They are for different clients, but theres doesn't appear to be a list of clients in your second table.

    If your second table listed a client, a product, and a date, a SUMPRODUCT formula could be utilized to retrieve that item's price without going to find it manually. Is that what you need?

    =SUMPRODUCT((RANGE1=CRITERIA1)*(RANGE2=CRITERIA2)*(RANGE3=CRITERIA3)*(RANGE4))

    =SUMPRODUCT((A1:A10=PRODUCT1)*(B1:B10=CLIENT1)*(C1:C10=a date)*(D1:D10)) would give you the price

  5. #5
    Registered User
    Join Date
    06-07-2009
    Location
    london, england
    MS-Off Ver
    excel 2010
    Posts
    36

    Re: Multiple criteria (finding closest)

    Hi, sorry I should have been clearer. The second table is looking up the price that is effective on those dates for Product A and Client 1.

    So on the 27th Feb and 28th feb 10.00 is the price but on the 1st mar the price has changed to 10.50. I want the formula to find the price which is effect as the pricing only changes every so often. The date in the second table may not be explicitly in the first table.

    Does that make sense?

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Multiple criteria (finding closest)

    It does. You would use an approximate match instead of exact which will round to the most recent date.

    I've attached a sample of how it could work.

    =INDEX(prices,MATCH(date,IF(products=specific product,IF(clients=specific client,dates))))

    Note the formula is entered as an array, using Ctrl+Shift+Enter instead of exiting the cell just using Enter.

    In my sample I used this, where I17 had a specific date, G17 was ProductA, and H17 was Client1.

    =INDEX(D3:D10,MATCH(I17,IF(A3:A10=G17,IF(B3:B10=H17,C3:C10))))


    three criteria match.xlsx

  7. #7
    Registered User
    Join Date
    06-07-2009
    Location
    london, england
    MS-Off Ver
    excel 2010
    Posts
    36

    Re: Multiple criteria (finding closest)

    Thanks that works really well. Really appreciate your help.

  8. #8
    Registered User
    Join Date
    02-11-2015
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    1

    Re: Multiple criteria (finding closest)

    thanks its good for matching a value.

+ 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. [SOLVED] Find a number closest to 30 in a range with one more criteria (criteria includes text)
    By Sarangsood in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-22-2013, 01:16 PM
  2. [SOLVED] Finding the closest value
    By Hitch75 in forum Excel General
    Replies: 2
    Last Post: 06-09-2012, 01:09 PM
  3. Finding a closest match with more than one criteria
    By Jayana in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-15-2011, 06:45 PM
  4. closest match from multiple criteria
    By wongja in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2010, 01:37 AM
  5. Finding closest value in VBA
    By Christian411 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2009, 07:53 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