+ Reply to Thread
Results 1 to 4 of 4

Index & Match multiple values

  1. #1
    Registered User
    Join Date
    03-24-2010
    Location
    Oxford
    MS-Off Ver
    Excel 2007
    Posts
    16

    Index & Match multiple values

    Hello.

    I'm trying to use the index and match function to give me a result from looking up to criterias.

    =INDEX('Hotel Report'!$A$2:$AQ$412,MATCH('Hotel Rooms'!$A2,'Hotel Report'!$B$2:$B$174,0),MATCH('Hotel Rooms'!B$1,'Hotel Report'!$A$1:$AR$1,0))

    Above is the formula I have used but all i get back is #N/A

    I'm basically looking up if a room number has been used or not, however the room number may apear twice in the report.

    Can anyone help, file attached

    Thanks
    Attached Files Attached Files
    Last edited by jmcgallan; 11-05-2010 at 11:33 AM. Reason: Solved

  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,463

    Re: Index & Match multiple values

    It doesn't like the Room Numbers on the Hotel Report sheet.

    For some reason, they look like numbers but they seem not to be, hence not matching the true numbers on the Hotel Rooms sheet.

    You need to coerce the room numbers to be numeric. You can do this using Paste Special with an arithmetic function. Put a 1 in a free cell. Copy it. Select all the cells in the Room Number column. Choose Paste Special and Multiply.

    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
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Index & Match multiple values

    You can transform the numeric room numbers in the "Hotel Rooms" sheet into text values within your formula by concatenating them with an empty string

    Hotel Rooms'!$A2&""

    =INDEX('Hotel Report'!$A$2:$AQ$412,MATCH('Hotel Rooms'!$A2&"",'Hotel Report'!$B$2:$B$174,0),MATCH('Hotel Rooms'!B$1,'Hotel Report'!$A$1:$AR$1,0))

    And you do not need to enter the formula as an array formula. A simple Enter will suffice. Copy across and down.

    The remaining #N/A values are there because some room numbers, e.g. 909 are not listed in the "Hotel Report" sheet.

    cheers,

  4. #4
    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,463

    Re: Index & Match multiple values

    @Teylyn: I like the alternative approach which means you don't need to change the data. I wonder why it's not consistent though, and if it should be.

    @jmcgallan: I think this still leaves you with the problem of multiple entries as you'll get the first one for each room. I'm not sure of the best approach for that and it rather depends on what, if anything you want to change in your worksheet.

+ 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