+ Reply to Thread
Results 1 to 4 of 4

If Search Issue

  1. #1
    Registered User
    Join Date
    03-04-2015
    Location
    Arizona
    MS-Off Ver
    MS Office 2010
    Posts
    2

    If Search Issue

    I have an issue which i almost have solved with one hiccup.

    I have a cell of information that looks like: A1; A4; C6; H9
    It's just text. I then have a series of columns that looks to see if A1, A2, A3 etc is in that original cell.

    =IF(ISNUMBER(SEARCH(F$1,Main!$AY9)),"L","")

    This is basically the formula I used. It searches AY9 in "Main" to see if the contents in F1 are in that cell. Works great.

    The problem comes if the info is: A1; A6; C12

    The column for C1 and C12 are both triggered and the "L" will be in both columns. And I would only want it in C12. I thought about doing another search where if the cell contains C12 then don't put the L in C1, but the cell might: A1; H3; C1; C12 and then I would want it in both cells.

    Is there a way I can differentiate between C1 and C12 with some formula?

    Thanks.

  2. #2
    Registered User
    Join Date
    07-09-2014
    Location
    Wellington, New Zealand
    MS-Off Ver
    2010
    Posts
    3

    Re: If Search Issue

    So you're searching for a text string, but only wanting to find some occurrences of that string, and omit others. For example, you want to find the text "C1" which could be anywhere in a cell, but not if it's followed by a character other than a semicolon.

    I have a solution which seems to work for me, but it's not particularly elegant (in fact it's pretty ugly - I'm sure there's a "cleaner" option). It first checks whether "C1" appears in the target cell at all and returns "" if it does not. If "C1" is found, it then checks for two other conditions: (1) Is "C1" followed by a semicolon, or (2) is C1 the last two characters in the cell. If either of these conditions are met it returns the value "L", else it returns "".

    Here it is:
    =IF(NOT(ISNUMBER(SEARCH(F$1,Main!$AY9))),"",IF(OR(MID(Main!$AY9,SEARCH(F$1,Main!$AY9)+LEN(F$1),1)=";",SEARCH(F$1,Main!$AY9)+LEN(F$1)=LEN(Main!$AY9)+1),"L",""))
    Last edited by whero; 03-04-2015 at 09:11 PM.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: If Search Issue

    Hi, welcome to the forum

    I suggest you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    03-04-2015
    Location
    Arizona
    MS-Off Ver
    MS Office 2010
    Posts
    2

    Re: If Search Issue

    Ok, here is a sample of what is happening.

    Thanks.
    Attached Files Attached Files

+ 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. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  2. [SOLVED] Search and Matching issue
    By trianglet in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-26-2012, 04:11 AM
  3. [SOLVED] Issue - Not Reflecting in advanced search
    By mahju in forum Suggestions for Improvement
    Replies: 18
    Last Post: 03-25-2012, 01:15 PM
  4. [SOLVED] Issue - Search issue - by SHG
    By Vaibhav in forum Suggestions for Improvement
    Replies: 0
    Last Post: 02-09-2012, 06:29 AM
  5. VLOOKUP/Search issue
    By dabman in forum Excel General
    Replies: 9
    Last Post: 12-08-2008, 12:44 PM

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