+ Reply to Thread
Results 1 to 6 of 6

Number repeated strings

  1. #1
    Registered User
    Join Date
    06-22-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Number repeated strings

    Hi.
    If we have several names in a column in a excel worksheet which are repeated again n again how can we number them??
    so that if we are using a vlookup function or sum other we don't get the same data displayed
    Last edited by Munni; 06-24-2010 at 01:29 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Number repeated strings

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

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

    Re: Number repeated strings

    Let's say the names are in column A starting at A2. In B2 you could enter this formula:

    =IF(COUNTIF($A$1:$A2, $A2) = 1, $A2, $A2 & "(" & COUNTIF($A$1:$A2, $A2) & ")")

    Copy that cell downward to get a new list with numbers added to the duplicated values. Use that column for your VLOOKUP since it now has unique values on every row.
    _________________
    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!)

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

    Re: Number repeated strings

    =countif($a$2:a2,a2)&"-"&a2
    "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

  5. #5
    Registered User
    Join Date
    06-22-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Number repeated strings

    Quote Originally Posted by JBeaucaire View Post
    Let's say the names are in column A starting at A2. In B2 you could enter this formula:

    =IF(COUNTIF($A$1:$A2, $A2) = 1, $A2, $A2 & "(" & COUNTIF($A$1:$A2, $A2) & ")")

    Copy that cell downward to get a new list with numbers added to the duplicated values. Use that column for your VLOOKUP since it now has unique values on every row.

    Thanks JBeaucaire..Its working...

  6. #6
    Registered User
    Join Date
    06-22-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Number repeated strings

    Quote Originally Posted by martindwilson View Post
    =countif($a$2:a2,a2)&"-"&a2
    Thanks martin...Its working

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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