+ Reply to Thread
Results 1 to 19 of 19

FIND function exact match

Hybrid View

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    FIND function exact match

    Good morning,

    Is there anyway that I can make this formula look for an exact match?

    =IFERROR(IF(FIND(D$1,catdata!$C2, 1)>0,D$1)," ")

    This formula is repeated across columns D to Q looking for different models (in D1 to Q1) within Column C (which links to my catdata). Please see attached image.

    The problem i'm having is that when LF45 is in column C it is being matched to F45 in column D (incorrectly) and LF45 in column N. The same with LF55, this is matched to F55 in Column E (incorrectly) and LF55 in column Q.

    excel1.JPG

    Thanks
    Katie

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,620

    Re: FIND function exact match

    Hi
    please post a sample sheet. A picture is nice to look at but useless and requires unnecessary retyping - Thx

  3. #3
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Apologies, please see attached.

    excelmodels.xlsx

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: FIND function exact match

    Use this in D2 and drag across
    =IF(ISNUMBER(FIND(", "&D$1,", "&$C2)),D$1,"")

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Fantastic - thank you very much! :D

  6. #6
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    I've just tested this with some more data and when there is a model CF75IV it separates into both
    CF75 and CF75IV. Is there a way to tweak this to get it working for these ones as well? I've attached the spreadsheet.

    Thanks
    Katie

    excelmodels2.xlsx

  7. #7
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: FIND function exact match

    well this is a long formula, on D2:
    =IF(IFERROR(MID(RIGHT($C2,LEN($C2)-(FIND(", "&D$1,", "&$C2)-1)),1,IF(ISNUMBER(FIND(",",RIGHT($C2,LEN($C2)-(FIND(", "&D$1,", "&$C2)-1)),1)),FIND(",",RIGHT($C2,LEN($C2)-(FIND(", "&D$1,", "&$C2)-1)),1)-1,LEN(RIGHT($C2,LEN($C2)-(FIND(", "&D$1,", "&$C2)-1))))),"")=D$1,D$1,"")
    copy down and across.
    Last edited by SDCh; 12-12-2013 at 10:33 AM.
    Click (*) if you received helpful response.

    Regards,
    David

  8. #8
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: FIND function exact match

    try this function:
    Option Explicit
    
    Function FindMe(strSource As String, strMatch As String) As String
    
    Dim i As Integer
    Dim j As Integer
    Dim intK As Integer
    Dim strModel(5) As String
    
    FindMe = ""
    i = 0
    j = 1
    Do While InStr(j, strSource, ", ", 1) > 0
        If i = 0 Then intK = 0 Else intK = Len(strModel(i - 1)) + 2
        strModel(i) = Mid(strSource, j, InStr(j, strSource, ", ", 1) - 1 - intK)
        j = j + Len(strModel(i)) + 2
        i = i + 1
    Loop
    strModel(i) = Mid(strSource, j, 10)
    
    
    
    For j = 0 To i
        If strModel(j) = strMatch Then FindMe = strMatch
    Next
    
    End Function
    once you have the function in a module, you just type in the cell(D2): =FindMe($c2,d$1) and then drag it across your whole range.
    Click on the star if you think I helped you

  9. #9
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Thank you for this. I'm not sure where to copy and paste this function? How do I get a module? I'm fairly new to formulas in excel.

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: FIND function exact match

    =if(isnumber(find(" "&d$1&" "," "&substitute($c2,",","")&" ")),d$1,"")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  11. #11
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Thank you for this. I'm not sure where to copy and paste this function? How do I get a module? I'm fairly new to formulas in excel.

    Option Explicit

    Function FindMe(strSource As String, strMatch As String) As String

    Dim i As Integer
    Dim j As Integer
    Dim intK As Integer
    Dim strModel(5) As String

    FindMe = ""
    i = 0
    j = 1
    Do While InStr(j, strSource, ", ", 1) > 0
    If i = 0 Then intK = 0 Else intK = Len(strModel(i - 1)) + 2
    strModel(i) = Mid(strSource, j, InStr(j, strSource, ", ", 1) - 1 - intK)
    j = j + Len(strModel(i)) + 2
    i = i + 1
    Loop
    strModel(i) = Mid(strSource, j, 10)



    For j = 0 To i
    If strModel(j) = strMatch Then FindMe = strMatch
    Next

    End Function

  12. #12
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Thank you this works well

    Quote Originally Posted by martindwilson View Post
    =if(isnumber(find(" "&d$1&" "," "&substitute($c2,",","")&" ")),d$1,"")

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: FIND function exact match

    why not just use the function i posted ?vba seems a bit of overkill for a simple task
    Attached Files Attached Files
    Last edited by martindwilson; 12-12-2013 at 11:22 AM.

  14. #14
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: FIND function exact match

    1. Open Excel
    2. Press Alt + F11
    3. Click Insert (in the menu) and click Module
    4. In the new module, paste the code from my previous post
    5. In case you do not have any restrictions on running macros, then just go to your sheet and type = findme(xx,yy) (see my post above)
    6. If you have restrictions for running macros, it is getting a little more complicated. Buy we'll discuss that once you go through steps 1 to 5

  15. #15
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    Thank you for explaining how to do that, it works If for example F45 is not in C2, can the function put in a space rather than just leaving it blank?

    Thanks
    Katie

    Quote Originally Posted by adyteo View Post
    1. Open Excel
    2. Press Alt + F11
    3. Click Insert (in the menu) and click Module
    4. In the new module, paste the code from my previous post
    5. In case you do not have any restrictions on running macros, then just go to your sheet and type = findme(xx,yy) (see my post above)
    6. If you have restrictions for running macros, it is getting a little more complicated. Buy we'll discuss that once you go through steps 1 to 5

  16. #16
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: FIND function exact match

    just replace FindMe = "" with FindMe = " " in the above code

  17. #17
    Registered User
    Join Date
    12-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: FIND function exact match

    I've been testing these formulas on my data this morning and they work perfectly! They are going to save me hours of manual work - thank you so much for all of your help

  18. #18
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: FIND function exact match

    good to hear that :-)

  19. #19
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: FIND function exact match

    Pl see attached file.
    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. Replies: 13
    Last Post: 07-05-2013, 07:01 AM
  2. Replies: 3
    Last Post: 06-17-2013, 12:37 PM
  3. [SOLVED] Problem with Find function. Need to find Exact match
    By SMILE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2012, 07:07 AM
  4. Find exact match
    By indimonk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-30-2012, 11:25 PM
  5. [SOLVED] Find exact match.
    By Robert.Cordani@us.schneider-electric.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2006, 12:55 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