Copy excel entries into new work sheet and rearrange the values

Status
Not open for further replies.

KokoroAyo

New Member
Joined
Sep 8, 2017
Messages
14
Dear All,

I need help with an assignment.

In my place of work, we manage patients (entitled) for healthcare. We get the list of patients from the insurance agency as PDF file and they are not ready to give it in any other format. At the moment, we operate manually and therefore, to identify a patient, we have to search the using the find tool. This has become very cumbersome and we thought of doing something a little semi automated by creating a small database for patients as they are released every month. This will help us keep proper record of activities so we decided to use Excel to manage the list and later move to Access or any other DBMS.

We got a commercial PDF to Excel converter which gives about 90% accuracy in conversion and I think I can manage with that. My challenge now is that:
1. The list is formatted in Master-Detail (Header-List) Format.
2. We need it formatted in Individual Record format
3. It took 3 weeks to get the first trial completed manually having 3 people working on it. By then A new list (comprising of about 50,000 patients) would have been released as new one comes in every month.
4. Therefore, I need a macro to help me scan through the converted Excel document, extract the relevant data and rearrange them in the required format (on the same sheet or on a new sheet (preferably)).

Kindly help me please. My job depends on this.

Please see some relevant samples below.

A screen shot of a sample data section with some explanations
This is a cross section of the data. It shows how data is formated. There are more up and more down. Rows between lists are not equal in all cases. There are Headers and Footers in between as exported from the PDF document.

In this example:
1. Row 26645 is a header (and there are footers too) so it will be removed and not in the output
2. Row 26645 will be splitted as follows:
i. Hospital No is unique to each hospital. I will form a new column
ii. Hospital Name Will form a new Column. *** It can be ignored because I have the list of hospitals and can merge that.
3. Rows 26647 to 26649 carries a Family Record. The next family
4. Row 26647 contains Family ID number and Family Name. Only the Family ID is required here without the asterisks. This number will be used for every family member
5. Column A contains UnidPersonId in the family and Family Name. 0=Principal, 1 to N for others as indicated. So A new Column called Client_No will contain FamilyNumber+PatientNO. (eg. for 26648, ClientNo will be 027922670), then Another Column for FamilyName: (Sanusi in this case)
6. Column B is "First Name"
7. Column C contains "Date of Birth", "Gender" and "Batch Number". This will be broken up into 3 Coulumns. DateOfBirth, Gender, and BatchNumber. Batch number can be ignored if the first 2 are extracted.

Failed image code removed by Moderator



Excel Extract of the above screen shot
Ronsberger Nigeria Ltd.
Issued by NHIS
OY/0250 Catholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo State
*02792267* SANUSI
0 Principal SANUSITEMILADE02/11/1980 M E/240
1 Spouse SANUSIOLUWADAMILOLA 19/03/1992 F E/240
*02792269* OKOLO
0 Principal OKOLOEMMANUEL 23/10/1980 M E/240
2 Child1 OKOLOCHUKWUEMEKA 13/06/2015 M E/240
3 Child2 OKOLOUZOAMAKA 03/05/2013 F E/240
*02792277* AWOLOLA
0 Principal AWOLOLAAJIBOLA10/08/1977 M E/240
1 Spouse AWOLOLAABIDEMI05/08/1982 F E/240
2 Child1 AWOLOLAMORAYOOLUWA 20/06/2012 F E/240
*02792285* AGBABIAJE
0 Principal AGBABIAJETOLULOPE26/07/1985 M E/240
*02792353* ODUGBEMI
0 Principal ODUGBEMIRAFIU13/02/1981 M E/240
1 Spouse ODUGBEMITOYIN04/08/1990 F E/240
2 Child1 ODUGBEMIOLAMIDE25/07/2012 F E/240
3 Child2 ODUGBEMIEMMANUEL 10/10/2006 M E/240
*02839471* ADEJIMI
0 Principal ADEJIMIADEKUNLE 28/06/1978 M E/344
1 Spouse ADEJIMIOLUBUNMI 14/07/1979 F E/344
2 Child1 ADEJIMIOLUWADABIRA 08/07/2007 M E/344
3 Child2 ADEJIMIDAMILOLA 26/04/2009 M E/344

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>




Sample Output with Explanation
SN (Serial Number - Autogenerated)
CLIENT_NUMBER (HEADNUMBER without the '*' + UNIT NUMBER AS IN DOCUMENT) - PLEASE TAKE NOTE OF LEADING ZEROS
SURNAME (FAMILY NAME AS IN DOCCUMENT)
FIRST_NAME (AS IN DOCUMENT)DATE_OF_BIRTH (AS IN DOCUMENT)GENDA (AS IN DOCUMENT)FAMILY_MEMBERSHIP (AS INDICATED IN DOCUMENT) - Options are: Principal, Spouse and ChildHOSPITAL_NAME (COPY HEADER HOSPITAL NAME FOR ALL CLIENTS FOUND UNDER IT)HOSPITAL_ID (COPY CORRESPONDING HEADER HOSPITAL ID FOR ALL CLIENTS FOUND UNDER IT)
See Examples Below
1027922670
SANUSITEMILADE02/11/1980MPrincipalCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
2027922671
SANUSIOLUWADAMILOLA19/03/1992FSpouseCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
3027922690OKOLOEMMANUEL23/10/1980MPrincipalCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
4027922691OKOLOCHUKWUEMEKA13/06/2015MChildCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
5027922692
OKOLOUZOAMAKA03/05/2013FChildCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
6027922770
AWOLOLAAJIBOLA10/08/1977MPrincipalCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
7027922771
AWOLOLAABIDEMI05/08/1982FSpouseCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250
8027922772
AWOLOLAMORAYOOLUWA20/06/2012FChildCatholic Hospital, Oluyoro - Oluyoro, Ibadan, Oyo StateOY/0250

<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>


Kindly help me on this.

Thank you in advance.
 
Last edited by a moderator:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Duplicate to https://www.mrexcel.com/forum/excel-questions/1022138-copy-excel-entries-into-new-work-sheet-rearrange-values.html

Please do not post the same question multiple times. Questions of a duplicate nature will be locked or deleted, per #12 of the Forum Rules and points 6 & 7 of the Forum Use Guidelines.

Any bumps, clarifications, or follow-ups should be posted to the linked thread.

Note also that both posts required very large failed image code to be removed. My signature block below has a link with suggestions for how to post small screen shots directly in your post. In any event, please use the Test Here forum until you gets your posts showing corrrectly, rather than messing up a main forum.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top