Sorting multiple rows under one heading

Aurry

New Member
Joined
Jul 13, 2011
Messages
1
Hi everyone

I am working on a database that was started by another student a few years ago. The way it was set up was not very user friendly and I am having trouble changing into a format that will be easy to use and update in the future

I am not sure what numbering format was used to list the people in the database, but I would love to be able to list them all alphabetically. I know how to do this if all the info was in one row, but how do I keep multiple rows together under one person's name?

I've attached a picture of what it looks like right now
eg. Patient B's data is spread out horizontally in multiple rows. I need to be able to link all that information in the rows to Patient B. How do I do this? Is it even possible? I am a basic excel user - I know nothing about macros

Thanks for your help!

Excel.jpg
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
You could create a couple of temporary helper columns to combine the names in each row and then sort on helper columns.

Example:
<br /><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;;">Last name</td><td style="font-weight: bold;;">First Name</td><td style="font-weight: bold;;">Data</td><td style="font-weight: bold;;">Helper column 1</td><td style="font-weight: bold;;">Helper column 2</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Smith</td><td style=";">Joe</td><td style="text-align: right;;">34</td><td style="text-align: center;;">SmithJoe</td><td style="text-align: center;;">SmithJoe2</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">44</td><td style="text-align: center;;">SmithJoe</td><td style="text-align: center;;">SmithJoe3</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;">SmithJoe</td><td style="text-align: center;;">SmithJoe4</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">55</td><td style="text-align: center;;">SmithJoe</td><td style="text-align: center;;">SmithJoe5</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">Jones</td><td style=";">Jim</td><td style="text-align: right;;">22</td><td style="text-align: center;;">JonesJim</td><td style="text-align: center;;">JonesJim6</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: center;;">JonesJim</td><td style="text-align: center;;">JonesJim7</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">33</td><td style="text-align: center;;">JonesJim</td><td style="text-align: center;;">JonesJim8</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">34</td><td style="text-align: center;;">JonesJim</td><td style="text-align: center;;">JonesJim9</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">Doe</td><td style=";">Jane</td><td style="text-align: right;;">100</td><td style="text-align: center;;">DoeJane</td><td style="text-align: center;;">DoeJane10</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">50</td><td style="text-align: center;;">DoeJane</td><td style="text-align: center;;">DoeJane11</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">22</td><td style="text-align: center;;">DoeJane</td><td style="text-align: center;;">DoeJane12</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;">23</td><td style="text-align: center;;">DoeJane</td><td style="text-align: center;;">DoeJane13</td></tr></tbody></table><br /><br /><table cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">D2</th><td style="text-align:left">=IF(<font color="Blue">A2<>"",A2&B2,D1</font>)</td></tr><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">E2</th><td style="text-align:left">=D2&ROW(<font color="Blue"></font>)</td></tr></tbody></table></td></tr></table><br />

The two helper columns (D and E in this case) can be any empty columns.

The formula in D2 combines the Last and First names . If the Names don't exist in the row then the combined names from the previous row is used. Copy the formula in D2 down column D.

The formula in E2 numbers each of the combined names in column D. This is so the rows for a given name are not sorted. Copy the formula in E2 down column E.

Before you sort on Column E, you want to convert the formulas into values so the values don't change during the sort. Select column E and copy. Select from the menu...
Edit \ Paste Special: Values

You should now be able to sort on column E and all the data for a given name should stay grouped together. You could delete the helper columns after the sort.
 
Upvote 0

Forum statistics

Threads
1,224,547
Messages
6,179,436
Members
452,915
Latest member
hannnahheileen

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