+ Reply to Thread
Results 1 to 6 of 6

[SOLVED] Getting Match to use a cell reference as part of another cell reference

  1. #1
    Registered User
    Join Date
    01-07-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    [SOLVED] Getting Match to use a cell reference as part of another cell reference

    I want to create a sorted list based on an input I enter. Here is the formula I am using:

    =INDEX($S$5:$S$41,MATCH(H5,TEXT(N3,0)&"$5:"&TEXT(N3,0)&"$41",FALSE),1)

    The value of N3 is X

    Therefore, I would expect it to treat this formula as:

    =INDEX($S$5:$S$41,MATCH(H5,X$5:X&$41,FALSE),1)

    Instead, I get a #VALUE! error

    Is it possible to use a cell reference as part of another cell reference with the MATCH function?

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Getting Match to use a cell reference as part of another cell reference

    Any time you use the "&" to join strings, Excel automatically returns this as text - not a range address. You must use the INDIRECT function to convert the text string into a range address.

    Try this:

    =INDEX($S$5:$S$41,MATCH(H5,INDIRECT(N3&"$5:"&N3&"$41"),FALSE),1)
    Last edited by Palmetto; 02-25-2010 at 03:50 PM.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

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

    Re: Getting Match to use a cell reference as part of another cell reference

    I'm pretty sure you'll need INDIRECT() for that syntax. But maybe you just need an INDEX/MATCH/MATCH approach.

    If you post a sample workbook so we can see the actual data structure and what values you're trying to match to the table, maybe we can suggest something less volatile than INDIRECT().

    Click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    01-07-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    38

    [SOLVED] Re: Getting Match to use a cell reference as part of another cell reference

    Thank you Palmetto and JBeaucaire - Palmetto's solution worked. You guys are great! I would have spend a lot of time trying to figure it out.

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

    Re: [SOLVED] Getting Match to use a cell reference as part of another cell reference

    Yeah, INDIRECT() is great, I use it in small doses. If you find you are needing a LOT of these formulas, you might want to come back and see if we can help find a less volatile approach, INDIRECT() formulas are calculating 100% of the time, every time you make any change anywhere in your workbook. Most other functions don't do that. So, too many INDIRECT() can cause performance issues, but I'm sure you'll notice if that starts to happen.

    Go team.

  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: [SOLVED] Getting Match to use a cell reference as part of another cell reference

    Glad you got the solution you needed.

    Thanks for marking the thread as solved and adding to reputations.

+ 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