+ Reply to Thread
Results 1 to 7 of 7

Match value to parent ABOVE containing specific text

  1. #1
    Registered User
    Join Date
    12-02-2014
    Location
    Bristol
    MS-Off Ver
    2003/2007
    Posts
    9

    Match value to parent ABOVE containing specific text

    I would like to perform a check to see where a child value sits within a parent hierarchy from a database download. The child value always starts with “C” the parent with an “S”. All the data is contained within the same column.

    I am looking for a formula rather than macro to locate the child value - and then look UPWARDS above it, to find the next instance of a value starting with ‘S’ (its parent).

    I can find the initial ‘C’ value using an index match, but cannot work out how to then locate the next instance of an ‘S’ value above it.

    Any help appreciated.

    Example sheet attached: Column B contains raw data, E contains values I wish to lookup, F contains the correct returned parent I wish to corroborate but don’t know how to.
    Attached Files Attached Files

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Match value to parent ABOVE containing specific text

    F2=IFERROR(LOOKUP(2,1/(LEFT($B$2:INDEX($B$2:$B$18,MATCH($E2,$B$2:$B$18,0)),1)<>"c"),$B$2:$B$18),"")
    TRY THIS AND COPY TOWARDS DOWN
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Match value to parent ABOVE containing specific text

    Hi,

    The most pragmatic solution would be a helper column C with
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    copied down

    Then in F2 copied down

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

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    12-02-2014
    Location
    Bristol
    MS-Off Ver
    2003/2007
    Posts
    9

    Re: Match value to parent ABOVE containing specific text

    These both look like excellent solutions, I will give them some time later after meetings.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080

    Re: Match value to parent ABOVE containing specific text

    Here's one way but I'm not keen on it

    =INDEX(B$2:B$18,MAX(ROW(INDIRECT("B$2:B$"&MATCH(E2,B$2:B$18,0)))*(LEFT(INDIRECT("B$2:B$"&MATCH(E2,B$2:B$18,0)),1)="s"))-1,1)
    Array formula, use Ctrl-Shift-Enter
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  6. #6
    Registered User
    Join Date
    12-02-2014
    Location
    Bristol
    MS-Off Ver
    2003/2007
    Posts
    9

    Re: Match value to parent ABOVE containing specific text

    Brilliant! 3 interesting, viable ways to tackle this. Im new to using excel for logic formulae, but this will make some big time gains. NFL - thank you, did not know a lookup could work like that, Richard that is an elegant solution, Special K - impressive, this is testing my understanding to the limit!

    Really appeciate your time and help!

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Match value to parent ABOVE containing specific text

    Glad to have helped and thanks for the 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. Outlook specific text to Excel VBA Stops after first match
    By cgcustomcomputers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2014, 08:26 AM
  2. Multi-Match lookup Formula w/specific Text Output
    By synergeticink in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-10-2014, 01:41 PM
  3. Search function, for specific text, but need to match if it starts with
    By andy.k in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-05-2013, 06:45 PM
  4. import text files multiple from parent directory
    By Craig.Selby in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 11:41 PM
  5. Help: Two cells to match a specific text
    By rmentex2011 in forum Excel General
    Replies: 3
    Last Post: 01-18-2011, 08:22 AM

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