+ Reply to Thread
Results 1 to 7 of 7

Matching specific characters in a row using INDEX/MATCH

  1. #1
    Registered User
    Join Date
    05-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    10

    Matching specific characters in a row using INDEX/MATCH

    Hi guys,

    I'm have an issue in Excel, which I'm so far not able to solve. I try to return the first cell in a row, containing either a number or a specific character. Let's say I have the following row:s

    XXO22O
    XXXXXX
    22OOXX

    I want the function to return the first row containing an "O" or a number, but not the X. The results here should be: first row: value in column 3/second row: #N/A/third row: value in column 1.

    I have the following seperate functions:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to match for an "O"
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to match for any number.

    I have combined these in a somewhat ugly formula usign an IF statement to see which of the previous formulas results' occurs earlier, e.g. has a lower column number, and return thr value of that result. I tried to post the formula as well, but got the following error message: Block reason: Your request was not authorized due to its content (HTML code not allowed)

    This simply looks at the column number, and gives the value of the cell that has the lowest column number. This would work when I only needed to match for one character and a numeric value However, this is a simplified example, in the real sheet I have to match for a number, or a possible 5 characters. Working this out with the above method would result in a long and complex formula. I am hoping there is a way to vombine the multiple matches I need into one INDEX formula, so that it returns the cell value of the first match that is true.

    I'm looking forward to your input, if this is at all possible. Thank you in advance.

    Kind regards,

    Bart

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,526

    Re: Matching specific characters in a row using INDEX/MATCH

    This array formula will yield 3 for the first row, N/A for the second, and 1 for the third as described in post #1:
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    05-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Matching specific characters in a row using INDEX/MATCH

    Hello JeteMc,

    Thank you for your reply. Unfortunately, I cannot get the formula to work. The first part returns column number within the array of the first "O", but the second part, matching the TRUE with ISNUMBER returns #N/B in my sheet. I can use it with my formula to match for a number (using the INDEX function) but then it matches the column number returned by the match in your formula, with the value of the cell returned by the second part of the formula. This second part would be 2, thus the result is 2.

    Do you know why the match on isnumber returns an error? And as I am now matching a column number, with a cell value, do you know if there is a way to simply return the cell which either has an "O" or a number, and not the column number? I am trying to do an OFFSET on the first cell in the array containing an "O" or a number.

    Any help will be highly appreciated

    Kind regards,

    Bart

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,526

    Re: Matching specific characters in a row using INDEX/MATCH

    My apologies, I forgot to include directions for activating an array formula which is why the error occurred. the directions are:
    1) select the cell with the formula,
    2) press the F2 key,
    3) press Ctrl, Shift and Enter simultaneously.
    I have changed the array formula to yield the cell in which "O" or a numeric entry occurs.
    Please Login or Register  to view this content.
    Below is a copy of your data with the array formula applied, the results are highlighted in yellow.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Matching specific characters in a row using INDEX/MATCH

    Hi JeteMc,

    Thank you for your reply! These functions are really helping me in solving my sheet. I got most parts to work now, but unfortunately I run into an error I can't solve yet. I'm sorry to ask for your expertise again, but maybe you know what causes this and if there is a workaround:

    If the formula tries to match for a character that is absent in the search array, the functions returns #N/A even if there is a number in the array. The function should return the number (cell of the number in this case), as this match criteria is met. Unfortunately it returns an error. Do you think there is a workaround for this or have I now run into the limits of Excel?

    You can see this in your sheet by changing the "O" to another character. The result is now #N/A instead of 2 (the indirect value of cell B4). Any ideas on this?

  6. #6
    Registered User
    Join Date
    05-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Matching specific characters in a row using INDEX/MATCH

    I was a bit fast posting above reply, I have seem to fixed it by using IF(ISNA();99999) to give the error a higher number then would be returned by the match on a number. In the MIN function the number cell is then returned. In your sheet this works as expected, however, when I use it in my large sheet, the address returns the expected cell, but when i use the INDIRECT around it, the cell becomes empty instead of giving me the number. Could this have to do with the fact that my input array is on another tab? This is my next puzzel I guess

    ----------------
    Update: It was indeed the issue that the INDIRECT referred to the same worksheet, solved it by adding the worksheet name in fron of the formula to refer to the other worksheet. Thanks for all the help, I believe I can now solve this whole part of the sheet. The second part would be to do the same, but then for the last cell containing the number or character, perhaps I can now solve that myself knowing what I learned from this thread
    Last edited by Phalanxz; 04-13-2016 at 03:10 PM.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,526

    Re: Matching specific characters in a row using INDEX/MATCH

    Quote Originally Posted by Phalanxz View Post
    The second part would be to do the same, but then for the last cell containing the number or character, perhaps I can now solve that myself knowing what I learned from this thread
    I certainly encourage exploration, that's how I learned a lot of what I share, however let me hint that finding the last cell containing "O" or a number will not be as easy as changing the Min function to a Max function. That said you are Welcome and thank you for the feedback. If your question has been answered to your satisfaction please take a moment, if you haven't already, to mark the thread 'Solved' using the thread tools link above your first post. I hope that you have a good day.

+ 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. return first four characters AFTER index match formula
    By ammartino44 in forum Excel General
    Replies: 2
    Last Post: 07-23-2015, 07:17 PM
  2. Vlookup or Index/Match only matching the first 8 characters.
    By CCPopsicle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-18-2014, 10:20 AM
  3. Replies: 3
    Last Post: 05-08-2013, 02:10 PM
  4. Replies: 1
    Last Post: 02-21-2013, 05:49 PM
  5. Replies: 13
    Last Post: 12-13-2012, 11:44 AM
  6. Index/ Match - error on letter characters
    By mikera in forum Excel General
    Replies: 2
    Last Post: 09-15-2011, 09:04 AM
  7. Using INDEX and MATCH to find the 2nd matching value?
    By mysterydave in forum Excel General
    Replies: 4
    Last Post: 01-22-2009, 10:23 AM

Tags for this Thread

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