VBA code to convert/encode multiple cells

  • [h=2][/h] [INDENT]I have a worksheet with several 000's rows of data, holding information about patients' visits. Each row holds the information of a single visit.
    Each patient can have multiple visits (i.e. appear in multiple rows). The table is sorted by patient name, and the left-most column holds the patient name.
    I need to share this sheet with others so that it can analysed, but due to data protection rules I wish to hide the personal information, i.e. patient name, before I do that.
    My plan is to keep a master copy of the sheet, just in case. I would like a make a copy of it, with the patient details anonymised, that can then be shared. I would like each patient name to be changed to a sequential number, something like P0001, P0002, etc. The left column of the table will appear like this:
    P0001
    P0001
    P0002
    P0003
    P0004
    P0004
    P0005
    ...

    How do I create the encoding automatically please?


    Any tips will be much appreciated![/INDENT]

  • first make a list of patient name in a new worksheet, remove duplicate then assign codes.. after that you can use vlookup to replace patient name with code.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!