+ Reply to Thread
Results 1 to 11 of 11

Need formula to solve a 3 Criteria Lookup

  1. #1
    Registered User
    Join Date
    02-08-2017
    Location
    New Jersey
    MS-Off Ver
    Office 365
    Posts
    12

    Need formula to solve a 3 Criteria Lookup

    Hi Experts,

    I was hoping to get some formula help with a complex lookup I'm struggling with.

    My data is structured as follows:
    * I have part numbers listed in Column A
    * I have month/year across in Row 1
    * For each part number, I have the stock quantity of that part for each month

    This table is a simplified view of what my data looks like

    Part # Sep-21 Oct-21 Nov-21 Dec-21 Jan-22 Feb-22
    Part 1 5 10 15 -7
    Part 2 100 200 -50
    Part 3 15 25 75 100 -50

    I need a formula that does the following:
    1. I need to do a lookup down Column A for a particular part number
    2. In the row where the part number is found, I need to look across that row and see when the quantity goes negative
    3. Once I find the negative quantity, I need to grab the date at the top of that column

    So, using my example, this formula would produce the following results:
    Part 1 ==> Dec-21
    Part 2 ==> Nov-21
    Part 3 ==> Jan-22

    I hope my explanation is clear. Any help that you can offer would be appreciated. Thanks in advance.

    TMc

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

    Re: Need formula to solve a 3 Criteria Lookup

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    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 Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,829

    Re: Need formula to solve a 3 Criteria Lookup

    Also, are you still on Ver. 2010? If not, please update it.

  4. #4
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Need formula to solve a 3 Criteria Lookup

    The following formula in B8 of the attached workbok does what you want I think.

    stock.png

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is an array formula and needs to be committed via CTRL-SHIFT-ENTER

    Let us know if this works for you.
    Attached Files Attached Files
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  5. #5
    Registered User
    Join Date
    02-08-2017
    Location
    New Jersey
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Need formula to solve a 3 Criteria Lookup

    I am using Office 365.

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Need formula to solve a 3 Criteria Lookup

    B8=aggregate(15,6,b1:g1/(a2:a4=b7)/(b2:g4<0),1)

  7. #7
    Registered User
    Join Date
    02-08-2017
    Location
    New Jersey
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Need formula to solve a 3 Criteria Lookup

    Per Alan's request, I've attached an example. Apologies, I should have added the attachment with the original post.

    A1:G6 is a matrix of part numbers and their stock quantities for each month represented in Row 1
    A10:F11 shows the results I am looking for. For example, the stock quantity of Part #1 goes negative in Feb-22 and Oct-21 for Part #2.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-08-2017
    Location
    New Jersey
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Need formula to solve a 3 Criteria Lookup

    Geoff, your formula works perfectly! Thanks for the quick response.

  9. #9
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: Need formula to solve a 3 Criteria Lookup

    B11=IFERROR(AGGREGATE(15,6,$B$1:$G$1/($A$2:$A$6=B$10)/($B$2:$G$6<0),1),"")

    Copy across

  10. #10
    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,879

    Re: Need formula to solve a 3 Criteria Lookup

    With Power Query, here is the Mcode to get the results you are looking for.

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Need formula to solve a 3 Criteria Lookup

    You are spoiled for choice for solutions! Thanks for the feedback and rep.

+ 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] the way we solve Solve equation. Can Excel solve this?
    By tta.akmal in forum Excel General
    Replies: 3
    Last Post: 08-10-2020, 07:49 AM
  2. Help with adjusting Index lookup formula to include additional lookup criteria
    By kingofcamden in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-14-2018, 01:04 PM
  3. If statements inside Lookup function or use VBA to solve an issue
    By eddthebed in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-29-2016, 01:48 PM
  4. Multi criteria lookup with the ''=lookup' formula
    By Ronnet2 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-17-2015, 07:12 AM
  5. [SOLVED] Lookup formula to find lowest value with variable lookup criteria
    By brharrii in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-27-2015, 03:00 AM
  6. [SOLVED] need formula to solve the condition criteria from 2 column
    By breadwinner in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-11-2013, 05:55 AM
  7. Replies: 1
    Last Post: 05-16-2011, 05:00 PM

Tags for this Thread

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