+ Reply to Thread
Results 1 to 2 of 2

Return a value from a row where two conditions are met

Hybrid View

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Return a value from a row where two conditions are met

    Hi,

    I have a sheet of data.

    There are multiple rows with the same record number (coloumn A) where the dates are different (coloumn B).

    So, i'd like to lookup where a record number occurs at the same time as a specified date - so two conditions.

    Ideally, I would then like to return a value from Coloumn C when this happens.

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Return a value from a row where two conditions are met

    How big is the data set?

    A) If it's small, you can do this with a formula. Let's assume:

    1) Codes in col A
    2) Dates in col B
    3) Code to find in G1
    4) Date to match in G2

    In G3, put this formula:

    =INDEX($C$1:$C$100, MATCH($G1&"-"&$G2, INDEX($A$1:$A$100&"-"$$B$1:$B$100, 0), 0))


    B) If the data is large, then I would add a helper column to the data set to keep the formula robust.

    1) In D2 add this starting formula:

    =$A2 & "-" & $B2

    2) Copy that formula down the whole dataset

    3) Then use this replacement formula in G3

    =INDEX($C:$C, MATCH($G1&"-"&$G2, $D:$D, 0))



    These formulas will give you the column C result when the code/date matches, and #N/A (not applicable) result when no match is found.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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