+ Reply to Thread
Results 1 to 3 of 3

Return a Row Entry bases upon Cell Value

  1. #1
    Registered User
    Join Date
    03-05-2011
    Location
    Savannah, GA
    MS-Off Ver
    Excel 2003 (work), 2010 (home)
    Posts
    44

    Question Return a Row Entry bases upon Cell Value

    I have a unique issue that I am wondering can be solved via a Macro or a formula. I will try to state it as easily as possible. In a workbook I have 2 worksheets, in my example I will call them "Categories" and "Layout".

    In cell M2 of "Layout" I would like to return the value of the cell in Row 1 of worksheet "Categories" that corresponds with the value of cell D2 in the worksheet "Layout". So simply put if Horse is in cell D2, I would go to worksheet "Categories" and search for the word Horse, once found, I would locate the value in Row one of the same column, and place that value in cell M2 of the worksheet "Layout", so in this example we see Horse is in Column A, and the value in cell A1 is "Animals" so I would like "Animals" returned in cell M2 of the "Layout" worksheet. And so forth and so forth. A value will never be in more than one column.

    Also in my example the worksheet "Categories" end in column M, but in actual workbook it can go over 50 columns and down 1000.

    Is this possible

    Thanks for any assistance!
    -Staci
    Last edited by Staci; 02-23-2012 at 08:05 PM.

  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 Row Entry bases upon Cell Value

    Put this array formula in M2:

    =INDEX(Categories!$A$1:$M$1, MIN(IF(Categories!$A$2:$M$8=D2,COLUMN(Categories!$A$2:$M$8))))

    ...and confirm it by pressing CTRL-SHIFT-ENTER. "Animals" should appear. Now copy that cell down the column.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    03-05-2011
    Location
    Savannah, GA
    MS-Off Ver
    Excel 2003 (work), 2010 (home)
    Posts
    44

    Re: Return a Row Entry bases upon Cell Value

    Thanks JBeaucaire! Works Great!

    ~Staci

+ 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