+ Reply to Thread
Results 1 to 13 of 13

Find a value and return value of the row and column header

  1. #1
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Smile Find a value and return value of the row and column header

    Hi All,

    I have a formulae problem, hope to receive some help!

    Example/Scenario:
    A Table
    Row 1 - list of name, eg. David, James, Mary, etc
    Column 1 - list of months, eg. Jan, Feb, Mar, etc
    Middle of table (content of table) are eg. red, orange, green, blue, pink, etc

    Problem:
    I would like to search for red from the table content.
    And, the result to return 'name' in row 1 and 'month' in column 1.

    eg. red is sitting at intercept of James and Mar.
    So, to search for red, and return 'James' and 'Mar'.

    May any expert help me out please? Much appreication in advance.

    Thank you!
    Attached Files Attached Files
    Last edited by JG2011; 10-31-2011 at 03:42 AM. Reason: To be more specific

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Help!

    @JG2011: welcome to the forum.

    Please take a few moments to read the forum rules and amend your thread title to something more specific and descriptive of your problem.

    A sample workbook is always helpful in developing a relevant and practical solution.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Help!

    Hi, may i ask, how to change the title and also attach a sample workbook pls? Thanks!

  4. #4
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Find a value and return value of the row and column header

    Hi All,

    I have a formulae problem, hope to receive some help!

    Example/Scenario:
    A Table
    Row 1 - list of name, eg. David, James, Mary, etc
    Column 1 - list of months, eg. Jan, Feb, Mar, etc
    Middle of table (content of table) are eg. red, orange, green, blue, pink, etc

    Problem:
    I would like to search for red from the table content.
    And, the result to return 'name' in row 1 and 'month' in column 1.

    eg. red is sitting at intercept of James and Mar.
    So, to search for red, and return 'James' and 'Mar'.

    May any expert help me out please? Much appreication in advance.

    Thank you!
    Attached Files Attached Files

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Help!

    For both, click on Edit and then the Go Advanced button. You should be able to edit the title there and upload a sample (seems you've achieved the second task)

    Regards

  6. #6
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Help!

    Quote Originally Posted by TMShucks View Post
    For both, click on Edit and then the Go Advanced button. You should be able to edit the title there and upload a sample (seems you've achieved the second task)

    Regards
    Thanks! I did it!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Find a value and return value of the row and column header

    Have a look at the attached sample workbooks.

    I can't claim any credit other than applying them to your data.

    The expertise has come from Mr Excel and Excel Is Fun (Trick No 7)

    I have to say, the formula approach is not the simplest but it works and avoids VBA. It's be interesting to see how easy or difficult you find it to use in your live workbook.


    There is also a VBA solution from the same source which I have adapted. Much easier to use but, as the name implies, it requires VBA


    Regards
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Find a value and return value of the row and column header

    First, really thanks for your effort to look into this and reply so quickly.

    May I ask, is there any simplier solution please? They are so complex for me to understand and follow.

    Thanks.

  9. #9
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Find a value and return value of the row and column header

    how to apply VBA pls? Thanks.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Find a value and return value of the row and column header

    On Excel, press Alt-F11 to open the VBA Editor.

    On the menu, click on Insert | Module

    Copy and paste the code shown below:

    Please Login or Register  to view this content.

    You then use the User Defined Function (UDF) like a normal function, thus:

    =RL(G9,$B$2:$F$6)

    Where G9 has the search item and $B$2:$F$6 is the table to be searched. Note that the table range needs to be absolute (with $ signs) if you plan to copy it.

    Regards

  11. #11
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Find a value and return value of the row and column header

    hi, thanks. let me try. hope it works. tx.

  12. #12
    Registered User
    Join Date
    10-29-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Find a value and return value of the row and column header

    Great. This is solved. I used the VBA. Though I cannot understand how it works, but it just work. Thanks!

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,433

    Re: Find a value and return value of the row and column header

    You're welcome.

+ 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