+ Reply to Thread
Results 1 to 9 of 9

Vba lookup with initial

  1. #1
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Vba lookup with initial

    Hi,

    This code works for a while until I tried to use an initial with a period. Example C. Santos, Mario L. Lopez, V. Rodriguez. But if I don’t use the initial with a period it works.

    Is there any better code to use so I be able to use the period with an initial? Thanks.

    Please Login or Register  to view this content.

    thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Vba lookup with initial

    What you posted is a worksheet formula, not VBA code.

    How is the name Sheet2 defined?

    Do you mean that it works if you don't use an initial at all? Or it works if you use the initial but without a period?

    I think it would help to attach your file because this is a data issue. See yellow banner at the top.

  3. #3
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Vba lookup with initial

    Ok..
    Here it is. When I select C. Smith then the error #N/A exist. But the rest were ok. Thanks.

  4. #4
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Vba lookup with initial

    I also noticed that I changed the initial to R. Smith then it will work.
    For some reason the C. and D. initials are not working with the code.

    Thanks.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Vba lookup with initial

    You need to change the 1st vlookup to include False as the final argument.

  6. #6
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Vba lookup with initial

    Hi Fluff13
    I don’t understand what you meant. Sorry...

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Vba lookup with initial

    It should be
    =IF(Y18="","",IF(VLOOKUP(Y18,Sheet2,2,FALSE)="", "", VLOOKUP(Y18,Sheet2,2,FALSE)))
    the same as you have in the 2nd vlookup

  8. #8
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Vba lookup with initial

    Hi Fluff13

    I think it worked. Thank you so much.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Vba lookup with initial

    Glad to help & thanks for the feedback.

+ 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: 1
    Last Post: 09-14-2016, 04:55 AM
  2. Replies: 3
    Last Post: 03-05-2015, 02:33 PM
  3. [SOLVED] First Name & Last Initial
    By mycon73 in forum Excel General
    Replies: 5
    Last Post: 01-01-2013, 02:45 PM
  4. [SOLVED] First Initial & Last Name?
    By mycon73 in forum Excel General
    Replies: 5
    Last Post: 11-12-2012, 02:55 PM
  5. Replies: 3
    Last Post: 03-09-2012, 03:19 PM
  6. Last initial
    By Mike Rogers in forum Excel General
    Replies: 14
    Last Post: 01-28-2006, 12:19 PM
  7. Remove middle initial from "first name middle initial"
    By Justin F. in forum Excel General
    Replies: 15
    Last Post: 09-26-2005, 02:05 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