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. I would like each patient name to be changed to a simply 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!