Comments on: MS Excel Sorting
http://ask.metafilter.com/32310/MS-Excel-Sorting/
Comments on Ask MetaFilter post MS Excel SortingWed, 08 Feb 2006 09:05:40 -0800Wed, 08 Feb 2006 09:05:40 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60Question: MS Excel Sorting
http://ask.metafilter.com/32310/MS-Excel-Sorting
I've got two columns in MS Excel. They each share 200 numbers. However, one of the columns has an additional 700 numbers. I want the column with 900 sorted in ascending order, with like numbers from the column of 200 beside those in the column of 900. How do I do that?post:ask.metafilter.com,2006:site.32310Wed, 08 Feb 2006 08:59:15 -0800panopticanexcelmicrosoftcomputersoftwareresolvedBy: jadepearl
http://ask.metafilter.com/32310/MS-Excel-Sorting#505154
Highlight the individual column then goto to the "data" pulldown menu => choose sort => then choose either ascending or descending. Repeat for the next column.comment:ask.metafilter.com,2006:site.32310-505154Wed, 08 Feb 2006 09:05:40 -0800jadepearlBy: jessamyn
http://ask.metafilter.com/32310/MS-Excel-Sorting#505156
If I understand you, you can just select both columns by clicking on the header letters. If the columns aren't next to eachother you can click one heading row and then CTRL-click the next one. Once the columns are selected, go under the Data Menu, choose which column to sort by [in this case, the 900 number one, whatever its name is Column A or whathaveyou] and choose Ascending. Tell Excel whether you have a header row or not and click okay. You can alays undo a sort by going under the Edit menu and choosing Undo, so don't feel bad trying this out to see if it works the way you want it to.comment:ask.metafilter.com,2006:site.32310-505156Wed, 08 Feb 2006 09:06:49 -0800jessamynBy: panoptican
http://ask.metafilter.com/32310/MS-Excel-Sorting#505165
I don't think I was completely clear. Column A has 900 unique numbers. Column B has 200 numbers which are also in Column A. I want to sort both of the columns so that, for instance, number 64538 in column B is beside 64538 in column A. Using either of the two above options just sorts column A and then column B in ascending order without regard to keeping like numbers on the same row.comment:ask.metafilter.com,2006:site.32310-505165Wed, 08 Feb 2006 09:13:18 -0800panopticanBy: panoptican
http://ask.metafilter.com/32310/MS-Excel-Sorting#505169
In other words, once sorted, it would look something like this:<br>
<br>
<pre><br>
64536<br>
64537<br>
64538 64538<br>
64539<br>
64540<br>
64541<br>
64542 64542<br>
64543<br>
64544<br>
</pre><br>
<br>
And so on.comment:ask.metafilter.com,2006:site.32310-505169Wed, 08 Feb 2006 09:15:37 -0800panopticanBy: raedyn
http://ask.metafilter.com/32310/MS-Excel-Sorting#505171
What jessamyn said.<br>
<br>
1) Select both columns (CTRL-click the column names like A & C)<br>
2) Data -> Sort -> Sort By ColumnA (or which ever has the 900 numbers)<br>
3) Click OK<br>
<br>
<br>
Which is just a different way of saying "what jessamyn said".comment:ask.metafilter.com,2006:site.32310-505171Wed, 08 Feb 2006 09:18:05 -0800raedynBy: raedyn
http://ask.metafilter.com/32310/MS-Excel-Sorting#505177
Wait, after reading your clarification one question:<br>
<br>
The peices of data that you want next to one another at the end, are they currently together?<br>
<br>
I mean, is it currently<br>
<br>
64542 64542<br>
<br>
or are they currently in no particular order and you want the like numbers to 'find' each other (for lack of better terminology).<br>
<br>
If they are currently in the same row and you want to KEEP them together, what jessamyn describes will work. Try it.comment:ask.metafilter.com,2006:site.32310-505177Wed, 08 Feb 2006 09:21:34 -0800raedynBy: jessamyn
http://ask.metafilter.com/32310/MS-Excel-Sorting#505178
So the numbers that are the same, let's say 64542 in column A and 64542 in Column B are not currently in the same row but you want them to be that way after the sort?comment:ask.metafilter.com,2006:site.32310-505178Wed, 08 Feb 2006 09:21:40 -0800jessamynBy: raedyn
http://ask.metafilter.com/32310/MS-Excel-Sorting#505182
(I don't know if I'm being clear, so here's another try)<br>
<br>
Is the table currently<br>
<br>
3 3<br>
4<br>
6<br>
2<br>
7 7<br>
3<br>
7<br>
8<br>
9 9<br>
1<br>
<br>
or is it currently<br>
3 3<br>
4 7<br>
6 9<br>
2<br>
7<br>
3<br>
7<br>
8<br>
9<br>
1comment:ask.metafilter.com,2006:site.32310-505182Wed, 08 Feb 2006 09:23:59 -0800raedynBy: panoptican
http://ask.metafilter.com/32310/MS-Excel-Sorting#505183
Nope. Not on the same row. In fact, both columns seem to be in random order at the moment. When sorting, I would indeed like the numbers in the 200 number column to find their buddies in the 900 number column.comment:ask.metafilter.com,2006:site.32310-505183Wed, 08 Feb 2006 09:25:01 -0800panopticanBy: DevilsAdvocate
http://ask.metafilter.com/32310/MS-Excel-Sorting#505184
Rather than "sorting" column B, I think it's going to be easier to determine whether a specified number is in column B. Here's a way to do that:<br>
<br>
Insert a new column between A and B. This new blank column is now column B, and the set of 200 numbers is in column C. Go ahead and sort column A on its own.<br>
<br>
Let's say the first number in column A is in A1, and the numbers in column C are in C1 through C200. In B1, enter the formula:<br>
<br>
=IF(COUNTIF($C$1:$C$200,"="&A1)>0,A1,"")<br>
<br>
Then drag the lower right corner of B1 down the column to B900, to fill the formula in all those cells.<br>
<br>
I'm assuming here that the numbers in column A are unique (no duplicates), and the numbers in column C are unique. If either has duplicates, this may not work the way you want it to. (For example, if "28305" appears three times in column A, and only once in column C, this formula would cause 28305 to appear three times in column B, which may not be what you want.)comment:ask.metafilter.com,2006:site.32310-505184Wed, 08 Feb 2006 09:25:15 -0800DevilsAdvocateBy: panoptican
http://ask.metafilter.com/32310/MS-Excel-Sorting#505185
To put things in context. What I have is a call list with 900 contacts that we used for a recent survey. 200 people completed the survey and so I have a seperate dataset. I want to be able to eliminate the 200 people who completed the sruvey from the call list. I am using phone numbers. I coped the phone number columns from my dataset and pasted it as a new column into my call list directly beside the phone numbers column.<br>
<br>
DevilsAdvocate's solution won't work.comment:ask.metafilter.com,2006:site.32310-505185Wed, 08 Feb 2006 09:28:58 -0800panopticanBy: sagwalla
http://ask.metafilter.com/32310/MS-Excel-Sorting#505187
I did this:<br>
<br>
Put the 900 column left (say col F, starting row 12), the 200 column right (G12) . Sort both ascending<br>
<br>
Then in column H put the following<br>
<br>
=+VLOOKUP(F12,G$12:G$25,1,FALSE)<br>
<br>
(where the rows in G are the range of the numbers)<br>
<br>
Copy this formula with the absolute references preserved <br>
<br>
This will put the numbers from col G opposite their numbers in H and will leave "N/A" for all the other columns.comment:ask.metafilter.com,2006:site.32310-505187Wed, 08 Feb 2006 09:30:46 -0800sagwallaBy: sagwalla
http://ask.metafilter.com/32310/MS-Excel-Sorting#505194
This was my output<br>
<br>
1 1 1<br>
2 5 #N/A<br>
3 8 #N/A<br>
4 44 #N/A<br>
5 5<br>
6 #N/A<br>
7 #N/A<br>
8 8<br>
9 #N/A<br>
11 #N/A<br>
22 #N/A<br>
33 #N/A<br>
44 44<br>
51 #N/Acomment:ask.metafilter.com,2006:site.32310-505194Wed, 08 Feb 2006 09:34:01 -0800sagwallaBy: DevilsAdvocate
http://ask.metafilter.com/32310/MS-Excel-Sorting#505195
<i>DevilsAdvocate's solution won't work.</i><br>
<br>
Why not?<br>
<br>
If inserting an extra column causes problems, you can undo it at the end. After doing what I described above:<br>
- highlight column B<br>
- Edit - Copy<br>
- (with column B still highlighted) Edit - Paste Special - Values<br>
- delete column C<br>
<br>
Then all the columns are back in their original places.<br>
<br>
If it won't work because you do have duplicate values, let me know and I can try to find a way around that. If it's something else, it would be helpful to know <i>why</i> my solution doesn't work for you before attempting to come up with a different one.comment:ask.metafilter.com,2006:site.32310-505195Wed, 08 Feb 2006 09:34:03 -0800DevilsAdvocateBy: beagle
http://ask.metafilter.com/32310/MS-Excel-Sorting#505196
DA's solution works for me on a small sample set. Maybe not for phone numbers with hyphens?comment:ask.metafilter.com,2006:site.32310-505196Wed, 08 Feb 2006 09:36:22 -0800beagleBy: panoptican
http://ask.metafilter.com/32310/MS-Excel-Sorting#505198
Actually it did work, I just did it wrong. sagwalla's worked too. Hooray.comment:ask.metafilter.com,2006:site.32310-505198Wed, 08 Feb 2006 09:37:16 -0800panopticanBy: Opposite George
http://ask.metafilter.com/32310/MS-Excel-Sorting#505200
sagwalla has it. <br>
<br>
If you want to fill column H with blanks instead of "N/A"s for the non-matches use this template:<br>
<br>
=if(VLOOKUP(F12,G$12:G$25,1,FALSE)=f12,f12,"")<br>
<br>
If you're a Nervous Nelli you might want to do it all in a scrap worksheet and then copy/paste special/value columns F and H in back into the original spot.comment:ask.metafilter.com,2006:site.32310-505200Wed, 08 Feb 2006 09:40:49 -0800Opposite GeorgeBy: Opposite George
http://ask.metafilter.com/32310/MS-Excel-Sorting#505201
Oops. Y'all did it while I was previewing!comment:ask.metafilter.com,2006:site.32310-505201Wed, 08 Feb 2006 09:41:18 -0800Opposite George