Forum Discussion

sales510's avatar
sales510
Copper Contributor
Jul 19, 2022
Solved

Create a new Column incorporating part of the information from 2 columns + numbers

Trying to create a column with the Code numbers of the following sample table:

PATNO

PAT_LAST

PAT_FIRST

009985

Lan

Mei

009986

Sochacki

Emilia

009987

Rodrigues

Jose

009988

Cherilyn

Somali

009989

Rodrigues

Maria

009990

Johnson

Oral

009991

Johnson

Tyler

 New Code column need to create\replace for record 009985 should be:

LANME000 - 8-DIGIST LONG; (FIRST 3-LETTERS OF THE PAT_LAST + 2 LETTERS OF THE PAT_FIRST + 3-ZEROS).  All the records must be the same way.

However, if SECOND record with the same PAT_LAST & PAT_FIRST comes across, then it should be LANME001 (increased by one digit up to 999)

This is a long table.

 Wondering is this process is possible with excel\SQL statement or any other way?

 Any help will be appreciated.

    • sales510's avatar
      sales510
      Copper Contributor
      Hello:
      Can we add the following into my original request:

      At the same time, the results like these LANME000; LANME001; LANME002; etc. must be assigned based on the entire column (Cell D2 through Cell D2000).

      Thanks,

Resources