+ Reply to Thread
Results 1 to 6 of 6

excel formula produces duplicate last names

  1. #1
    Forum Contributor
    Join Date
    09-19-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2007
    Posts
    140

    excel formula produces duplicate last names

    Hey all,

    I have an excel formula producing duplicate last names.

    For example, I have a list like this:
    Please Login or Register  to view this content.
    When there is an ampersand names must get split into two columns, so i use the below formulas:
    Please Login or Register  to view this content.
    and:
    Please Login or Register  to view this content.
    This has the resulting effect:
    Please Login or Register  to view this content.
    As you can see, the formula causes a duplicate of the last name in the first column. Any suggestion to refine formula so it doesn't cause that duplicate, yet doesn't negatively impact the other results?

    Thanks for any response
    Last edited by johnmerlino; 11-04-2010 at 10:17 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: excel formula produces duplicate last names

    The formula isn't causing that, your data is. How is a formula supposed to determine what pieces of the found string, if any, it's supposed to then go on a "no duplicates" hunt for?

    In this rare situation, fix the data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    09-19-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2007
    Posts
    140

    Re: excel formula produces duplicate last names

    But what if there's 800,000 rows. Is there a way to automate the removal of these duplicates?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: excel formula produces duplicate last names

    Put this formula in D15 and copy down, it will see if the first word in B15 is repeated in that cell, and if so give you the corrected string.

    =TRIM(IF(ISNUMBER(SEARCH(LEFT(B15,SEARCH(",",B15)-1), MID(B15, SEARCH(",", B15), LEN(B15)))), MID(B15, SEARCH(",", B15)+1, LEN(B15)), ""))

    Copy that down the column.
    Highlight and copy, then do an Edit > Paste Special > Values to remove the formulas, now you can Ctrl-down-arrow through that column and quickly verify the rows that were flagged as a possible concerns.

  5. #5
    Forum Contributor
    Join Date
    09-19-2010
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2007
    Posts
    140

    Re: excel formula produces duplicate last names

    Thanks it worked.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: excel formula produces duplicate last names

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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