+ Reply to Thread
Results 1 to 6 of 6

Extracting Row and Column Header Coordinates from a value search

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    Windsor, ON
    MS-Off Ver
    Excel 2010
    Posts
    2

    Extracting Row and Column Header Coordinates from a value search

    Hello Community,

    I hope I can explain the situation well, and hopefully someone is able to help. If the could be longer I would have included "when multiple cells can contain the same value"

    I have a very large dataset that I would like to apply the following searches to, but I will include a smaller sample that gets at the point.

    For example; in the following sheet:
    Cat Dog Lizard
    Red 1 2 3
    Yellow 4 5 6
    Green 7 8 1

    If I search for "2", I would like to get back "Red" and "Dog". I was able (by looking at other posts) come up with a series of formula that allow me to obtain the sheet coordinates and convert them into column and row headers (using SUMPRODUCT Row/Column); however, when multiple cells contain the same value, the output becomes the sum of that coordinate and is no longer a reference to a specific header, so a search for "1" would not give me "Red" and "Cat". Ideally, if I searched for "1" I would get back "Red" & "Cat" as well as "Green" & "Lizard", but I would be satisfied with a formula that even just gave me back one of the two header pairs.

    Is what I'm trying even possible?

    Much thanks in advance,

    JordanSample Workbook.xlsx

  2. #2
    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: Extracting Row and Column Header Coordinates from a value search

    Hi,

    This User Defined Function is one way.

    The function in the worksheet is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where your_range is the table including the column & row labels, and n is the identifier in the table that you want to use.

    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 03-06-2014 at 09:09 PM. Reason: removing redundant variables
    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.

  3. #3
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Extracting Row and Column Header Coordinates from a value search

    If you insist with formula, please see the file

    Regards
    Azumi
    Attached Files Attached Files

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting Row and Column Header Coordinates from a value search

    For the top-most, left-most headers when there are duplicate lookup values...

    Data Range
    A
    B
    C
    D
    1
    Cat
    Dog
    Lizard
    2
    Red
    1
    2
    3
    3
    Yellow
    4
    5
    6
    4
    Green
    7
    8
    1
    5
    6
    7
    8
    9
    -----
    -----
    -----
    -----
    10
    1
    Cat
    Red


    This array formula** entered in B10:

    =INDEX(B1:D1,MATCH(A10,INDEX(B2:D4,MIN(IF(B2:D4=A10,ROW(B2:D4)-MIN(ROW(B2:D4))+1)),0),0))

    This array formula** entered in C10:

    =INDEX(A2:A4,MIN(IF(B2:D4=A10,ROW(B2:D4)-MIN(ROW(B2:D4))+1)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    01-09-2013
    Location
    Windsor, ON
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Extracting Row and Column Header Coordinates from a value search

    Thank you all for your very timely responses. Each response was helpful both in solving the problem and furthering my understanding of excel.


  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting Row and Column Header Coordinates from a value search

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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] Search row and return column header
    By j_alexander in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-01-2012, 04:55 PM
  2. Search for column header and find all values and their row numbers in that column
    By woody83 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-14-2012, 03:11 PM
  3. search table display column header for n occurences
    By martin_mcnamara in forum Excel General
    Replies: 4
    Last Post: 01-28-2011, 10:00 AM
  4. Search Table, Display Column Header
    By mattalisch in forum Excel General
    Replies: 5
    Last Post: 01-27-2011, 05:31 PM
  5. Replies: 1
    Last Post: 05-02-2008, 04:57 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