I want to sort a list of names & addresses by surname. The data is laid out as follows: surname1is in a1,address in b1,b2,b3 surname2 in a4, address in b4,b5,b6. etc.
So basically I want to sort by column a, but keeping the addresses in col b attached to the correct surnames.
Been playing around with group/outline, but I don’t think the solution lies there.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
outline/group (97)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » outline/group (97)
- This topic has 3 replies, 4 voices, and was last updated 23 years, 4 months ago.
AuthorTopicWScormac9
AskWoody LoungerDecember 10, 2001 at 4:47 pm #363974Viewing 2 reply threadsAuthorReplies-
WSWassim
AskWoody LoungerDecember 10, 2001 at 5:15 pm #557262cormac9
To sort this kind of list properly you need to have something in the empty cells (A2 and A3 and B5 and B6) in your example.
I suggest you use a separate column with a series of numbers in 3s. Something like a series 1,1,1,2,2,2,3,3,3… and sort by that column to keep all the addresses together and using the A Column to sort alphabetically.
Hope this helps.
Wassim
-
WSdcardno
AskWoody LoungerDecember 10, 2001 at 7:00 pm #557326I can see two choices. If you sort on the file as it sits now the blank cells in column A (A2:A3, A5:A6, etc) will all group together in the sort – and the data in the coresponding cells in column B will no longer be associated with the correct name in column A. The technical term is unprintable in a family forum, but it will not be fun! (been there, incompetent clerical help has done that!).
You can either associate each of those cells with the correct name by copying the name information to the appropriate cells in column A, or you could put all the information in one row by moving the second and third address lines to the same row as the name and first line of the address. I recommend the latter, but lets deal with both techniques
To do the first one, you can use a little VBA routine as follows:
Sub FillBlank() Dim Cell As Range For Each Cell In Selection If Cell.Formula = "" Then Cell.Value = Cell.Offset(-1, 0).Value Next Cell End Sub
Select the relevant range in column A (ie – all the cells that have address values in column
and run the macro – it steps through the selection and drops the value found in the cell immediately above into any blank cell. In my opinion this looks horrible, but at least you will be able to sort the file and get meanigful results.
A much better alternative is to put all the required information onto one line. Put the following formulas in your s/sheet without the quotation marks:
in C1: "=b2" in D1: "=b3"
then select the range C1:D3 and copy it down the length of active cells in column B. Every fourth row in column C and D will have a formula placing the address information on a single row, with blanks in the intervening rows. Copy and then Paste Special | Values to transform the formulas into string values. Finally, if you sort the file on column A all the rows with blanks in column A will be sorted together. They are now redundant, and can be deleted. You will have names and addresses sortable by name (or by city, post code, etc if the address lines were normally laid out).
The advantage of this approach is that this format is much easier to use as a mailmerge source for Word – which is likely where you will want to use it in any event!
-
WSJohnBF
AskWoody LoungerDecember 10, 2001 at 7:05 pm #557328There are a few ways to go, and if you need to maintain this format, VBA may be best. However, the attached file shows a quick-&-dirty, one-time change to restructure your data into pure columns, after which the sorting is easy.
Sheet1 is how I understand your data is now laid out, Sheet2 restructures it using formulas, Sheet3 takes the formulas and copies the data over the formulas by using Edit, Paste Special, Values.
All that remains to be done is sorting the entire data, and then you ignore the “left over” address fields in column B.
If this won’t do it, let us know what you need.
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Windows 11 Windows Updater question
by
Tex265
3 minutes ago -
Key, Key, my kingdom for a Key!
by
RetiredGeek
4 hours, 15 minutes ago -
Registry Patches for Windows 10
by
Drcard:))
8 hours, 46 minutes ago -
Cannot get line length to NOT wrap in Outlining in Word 365
by
CWBillow
8 hours, 58 minutes ago -
DDU (Display Driver Uninstaller) updates
by
Alex5723
2 hours, 8 minutes ago -
Align objects on a OneNote page
by
CWBillow
14 hours, 14 minutes ago -
OneNote Send To button?
by
CWBillow
14 hours, 58 minutes ago -
WU help needed with “Some settings are managed by your organization”
by
Peobody
23 hours, 31 minutes ago -
No Newsletters since 27 January
by
rog7
19 hours, 27 minutes ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
3 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
50 minutes ago -
Google One Storage Questions
by
LHiggins
5 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
1 hour, 46 minutes ago -
Ancient SSD thinks it’s new
by
WSila
4 hours, 39 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
1 day, 14 hours ago -
WinRE KB5057589 fake out
by
Susan Bradley
1 day, 7 hours ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
22 hours, 17 minutes ago -
Firefox 137
by
Charlie
1 hour, 3 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 days, 2 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 days, 2 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 days, 2 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
22 hours, 46 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
2 days, 6 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
2 days, 12 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
2 days, 22 hours ago -
Office apps read-only for family members
by
b
3 days, 1 hour ago -
Defunct domain for Microsoft account
by
CWBillow
2 days, 22 hours ago -
24H2??
by
CWBillow
22 hours, 39 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
18 hours, 33 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
22 hours, 30 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.