# Match And Sort By Two Columns

Feb 4, 2010

Column A has customer name, columns B,C,D has corresponding sales data for
that month. Column E is blank. Column F has has customer name. Column
G,H,I has the same corresponding sales data for the next month.

Although Column A and F both have customer names, there are many changes
month over month with the addition and deletion of certain customers so the
rows do not match up exactly. Is there a quick way to have the rows match up
according to customer names in column A and F and then sort them
alpabetically?

Currently my list looks like this:
Jan Feb
A A
B C
D D
F E
H F
L G
M H

I would like it to look like this:
Jan Feb
A A
B
C
D D
E
F F
G
H H
L
M

## (Match & Sort) Sort Columns B And C So That A And B Match Up Numerically

Feb 26, 2009

I would like to sort columns B and C (keeping the two lined up together) so that A and B match up numerically.

## How Do You Sort Columns So That They Match Up With Other Columns With Like Data

Jul 2, 2008

I have two columns one is web addresses and the other is email addresses but the rows do not line up. I was hoping that since the second half of the email address matches the web address I could somehow sort them so that the email address column and web address column match up. Here is an example but keep in mind that this list is about 9k long and this is just a sampling so you may not see any in this example that match. Also I may have more than one email address per website.

## Match And Sort Data In 6 Columns?

Jan 6, 2014

Column A has donor name, column B has corresponding donation data for 2011. Column C has donor name, and column D has donation data for 2012. Column E has donor name, and column F has corresponding donation data for 2013.

Although Columns A and C and E all have donor names, there are many changes
from year to year with the addition and deletion of certain donors so the rows do not match up exactly. Is there a quick way to have the rows match up according to donor names in column each of the three columns? Secondarily, I need to sort by donation amount from highest to lowest (it can either be the total over the three years or based on any single year.

Currently my list looks like this:
2011 2012 2013
A A A
B C B
D D C
F E D
H F I
L G K
M H M

I would like it to look like this:
2011 2012 2013
A A A
B - B
C C -
- D-
- E-
F F F
G G G
H - -
L - L
- - M

Basically, I want to see the year over year giving for each donor. I've attached a sample for refrence. (I can't post the original due to confidentiality requirements.)

## Sort And Match 2 Columns Of Data

Jul 19, 2012

I have 3 columns of data and 30,000+ rows. Column A & B are related and column C contains some of the same values as column B but not an exact match. I'm looking for a way to sort columns A & B so that columns B & C match up and the data from column A is moved as well. For any data that has no match, a blank space should be input. Please see below.

A B C

red dog cat
blue cat dog
green mouse pig
yellow horse kitten

A B C

blue cat cat
red dog dog
green mouse pig
yellow horse kitten

## Move And Sort With One Column But Insert Extra Columns As Needed For Proper Sort?

Jan 13, 2014

Using DataEntry sheet for data.
Trying to rearrange the data to DataFormatedProperly sheet.
So far all I can accomplish is DataFormatedWrong sheet.

Edit: Not sure what happened but file was NOT understandable before. It should be correct now.

## Sort Horizontally. Sort Across Columns

Dec 30, 2006

I am trying to sort a long range of text that is placed horizontally in a spreadsheet. I can do it vertically with the sort function in Excel but it does not seem to work for text that is placed horizontally. Example is as below:

Inventory Accounts Human Resources

## Sort And Match

Dec 3, 2008

I consider myself an ok Excel user and use it within a window of comfort for lots of things successfully, however todays task has me stumped and extremely frustrated... cant see the wood for the trees...

I have a spreadsheet of data collected from two sources, columns A & B from one source and columns C to E from another.

There are usernames in columns B and C.

I need to sort the entire sheet so that a username in column B is aligned with the same name in column C (and keeps the rest of the data in the row together)

I have scoured the net for hours for what seems such a simple operation to no avail.

Example:

A B C D E

## Sort Multiple Columns, With Blanks, And Move All Columns Into One

Feb 15, 2010

I found this code on Ozgrid to sort all columns of a worksheet that were continuous with no gaps or spaces that works well:

Sub CopyToA()
Do While ActiveCell <> ""
Range(ActiveCell, ActiveCell.End(xlDown)).Cut Destination:=Range("a65535").End(xlUp).Offset(1, 0)
ActiveCell.Offset(0, 1).Select
Loop
End Sub

However, I've tried to manipulate the code myself to 1) find all columns that aren't empty then 2) sort each column individually (WITHOUT expanding the sort to other columns) and 3) combining all the numbers into one seperate column. There are many posts concerning sorting but not one that addressed this particular situation.

## Match 1st And 2nd Columns In 2 Sheets And Return 3rd / 4th And 5th Column If Match

Dec 15, 2013

[URL]

What im trying to do is match columns A & B from AUDIT Sheet to Columns A & B in MASTER sheet. If they match then pull columns C, D & E from MASTER into AUDIT.

## Getting 15 Columns In Spreadsheet To Sort On One Columns As It Alphabetizes

Jun 10, 2014

Have a spreadsheet with 15 columns. In one of the columns is the name of the company and that column is not in alphabetical order. The city, state, zip code, business type and all the other pertinent data about that company is in the same row as the name of the company. My intent would be to put the company names in alphabetical order and keep all the company information in the same row as the company name.

## Find, Match And Sort Macro

Jul 8, 2008

On my worksheet I have the 6 columns below starting in A1.

The Code is an ASX code and the PE is the price earnings for each code for the past 3 years

The 3 code columns A1, C1, E1 are letters and the 3 PE columns B1, D1, F1 are numbers.

I need to match and sort these so the codes with their PE's all match so I can compare them.

Using the codes in A1 to match the rest would be ideal as this is he most recent data.

Every year new stocks are added and some deleted so none of the rows match.

I have very basic vb skills and may be able to adapt some code already posted if anyone knows of some.

Code08 PE 08 Code07 PE 07 Code06 PE 06

AAC 3.4 AAC 5.5 AAC 12
AAF 6 AAE 13 AAI 3

## Formula To Reorder Data - Match/Sort/lookup

Jan 4, 2007

I have a data entry sheet for attendance that shows the individuals name, date and hours attended. Each individual attendance is addedd to a new row. I need to transpose this data and display it in a report table, with the names in column A and showing hours worked for each day of that week. The formula needs to accomodate the growing data entry sheet as records are added (I'm using a date picker to change the week in the report sheet).

I've tried match, lookup and index and have confused myself thoroughly! Below is a sample of the data entry sheet (on left) and report table (on right)

******** ******************** ************************************************************************>Microsoft Excel - Book1___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutH1I1J1K1L1M1=
ABCDEFGHIJKLM1SurnameDateHours**Surname1-Jan2-Jan3-Jan4-Jan5-Jan6-Jan7-Jan2Smith1-Jan-076**Smith63600363Jones1-Jan-076**Jones66000304Rogers1-Jan-076**Rogers60600005Hathaway1-Jan-076**Hathaway60600006Pearson1-Jan-076**Pearson60000007Wills1-Jan-076**Wills60000008Smith2-Jan-073**********9Jones2-Jan-076**********10Smith3-Jan-076**********11Rogers3-Jan-076**********12Hathaway3-Jan-076**********13Smith6-Jan-073**********14Rogers6-Jan-073**********15Rogers7-Jan-076**********16Rogers8-Jan-076**********17Rogers5-Feb-076**********18Smith6-Feb-076**********19Jones6-Feb-076**********20Rogers

## Subtracting 2 Columns Of Data From Each Other When Labels In Separate Columns Match

Feb 20, 2009

I have four columns of data, as follows:

label 1, value 1, label 2, value 2

I need to create a formula in the fith column that for each line will tell excel to:

look for entry in 'label 1' in 'label 2' if there is a match, then subtract value 1 from value 2, display result.

I have tried doing this with SUMIF but am getting nowhere fast....

## How To Match 2 Columns And Count Their Match

Jan 28, 2008

HOw can I match combination columns of A-F (row1) to combination H-M (rows1 to end) and show how

many are number matched in column N..

ex..
Rows

A

B

C

D

E

F

G

H

I

J

K

L

M

N

1

2

3

16

17

11

9

11

17

18

## Copy Columns Between Worksheets If The Columns Don't Match

Jun 7, 2006

I have 2 worksheets in which I have to copy one column of cells from one to
the other. The problem is that the "main" worksheet lists nearly 3,500
clients and I have to copy numbers into the "main" worksheet on weekly basis
from another worksheet that lists only about 1,100 of those 3,500 clients.

Both client lists are in alphabetical order, but I obviously cannot just copy
one column into the other, because then the numbers won't be matching the
correct clients.

## Match 2 Columns To 2 Seperate Worksheet Columns

Sep 11, 2006

Now i have one excel sheet with two separet sheets in it ( Sheet 1 ) and ( Sheet 2 ) . I have in sheet 1 a column A with material codes and ColB is discreption and Col C IS Prices . But in Sheet 2 Col D is materila Code and Col I is a price .

the recordes in sheet 1 are around 11000 but in sheet 2 are around 2200 where the sheet 2 has a specific materials from sheet 1 .

Now i want to update the prices in sheet 2 from sheet 1 for each item after confirm that the materila code in sheet 2 equal in sheet 1 so copy the price from sheet 1 to sheet 2

Sheet 2 is old prices and sheet 1 has new prices so i need update the new prices in sheet 2

## Match 2 Columns To Copy Information In Other Columns

Apr 21, 2007

I have 2 workbooks (workbook1 & workbook2). Information in column A and column N must match both workbooks per row/ cell (ie. if A2 and N2 in workbook1 match workbook2, copy information from 3 other columns (S, T, U from from workbook1 into workbook2 - cells S2, T2, U2). Workbook2 may have information in column S, T, U, but I need to over-write it with the information from workbook1. If the information does not match per that row/cell (ie. A2 in both worksheets are the same, but N2, they are not, so go to the next line that does match and copy the information into worksheet2). I do not want to use a V- lookup for this problem. I really need a marco.

## Auto-Merge Dates In 3 Columns And Then Auto-sort Merged Columns

Jan 10, 2012

I have dates values in 3 columns.

A1 - Header - "Holidays in XXXX'
B1 - Header - "Holidays in YYYY'
C1 - Header - "Leaves by YOU"

A2:B11 have static dates consisting of 10 dates in each column.
C2:C11 - the user may enter any date at any point of time.

I would like to auto-merge the dates in all the 3 columns (A2:C11) in a single column say D2:D31 and then the system should auto-sort the column based on dates in any one order. So as soon as the user enters a value in say cell C2, all the 10+10+1 dates should get sorted.

Also the constraint here is a user may not apply all 10 leaves at in a year. So many of the cells may have blank values.

## Sort All Columns Except For Few

May 3, 2009

I am using a formula but when it sorts with the data in the adjacent cells it does not update the reference cells properly.

For example here is the =SUMPRODUCT((\$F\$12:\$WWX\$12>=C1)*1,(\$F\$12:\$WWX\$12<=E1)*1,ABS(\$F\$13:\$ZZ\$13))

This code is located on row 13, when I do a sort function with all the data, this code is then moved to row 30, that is fine but the code changes in the following way:

=SUMPRODUCT((\$F\$12:\$WWX\$12>=C18)*1,(\$F\$12:\$WWX\$12<=E18)*1,ABS(\$F\$13:\$ZZ\$13))

C1 & E1 should not have changed at all, F13 & ZZ13 should have changed to F30 & ZZ30.

I am not sure if there is a way to fix the formula so it updates correctly, or these cells can stay in the same place as long as everything else sorts.

Is is possible to sort all columns except a few?

## Sort Columns A B C D And E

Jul 8, 2009

I am trying to get columns A:E on Sheet1 converted into columns A:H on Sheet2. I attached the workbook with the macro so you can see what I am talking about. I posted the same macro in the workbook below. It comes close to what I am trying to do but it only sorts based on Column E. I would like to include Columns A, B, C, and D in the sort instead of just Column E so the display will look like Sheet2.

## Sort Columns - First A / Then B / Then C

Oct 29, 2012

I'm having a bit of trouble creating a macro that will sort columns in order - I've created a form that allows people to select a broad category ie) Schools, then a sub category ie) Primary or Secondary, and type in a third ie) Projects or Teachers

I'm trying to write a macro so that once they enter the form, their choices will be automatically sorted alphabetically, first by column A, then B, then C - to look like:

Schools - Primary - Projects - A
Schools - Primary - Projects - B
Schools - Primary - Projects - C
Schools - Primary - Teachers - B
Schools - Secondary - Projects - C
Schools - Secondary - Teachers - A
Schools - Secondary - Teachers - B
Schools - Secondary - Teachers - C

However I'm having the issue where if column B or C are left blank - the columns are not sorted properly, and the categories in column A get separated out..?

My code at the moment looks like:

Range("A1").Select
ActiveSheet.Unprotect
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

[Code] .......

## VBA: Sort On Two Columns

Oct 22, 2008

I have the necessity to execute a macro for sorting a list of data on two columns.
More exactly, let's suppose to have this situation:

A 10/2/2008 FFFF GGGG HHH
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
B 08/1/2008 HHHH SSSS IIIII
C 15/10/2008 AAA BBBB CCC

I need this sort:
A 10/2/2008 FFFF GGGG HHH
B 08/1/2008 HHHH SSSS IIIII
B 01/3/2008 PPPP LLLLL NNNN
B 12/4/2008 XXXX JJJJJ PPPP
C 15/10/2008 AAA BBBB CCC

## Sort A To G And S Columns

Jun 26, 2006

r = Range("c65536").End(xlUp).Row
Range("a5:G" & r).Select

Selection.Sort Key1:=Range("G5"), Order1:=xlAscending, Key2:=Range("F5") _
, Order2:=xlAscending, Key3:=Range("C5"), Order3:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
Rows("4:" & r).Select
For i = 5 To r
Rows(i).Select
If i Mod 2 = 0 Then
Selection.Interior.ColorIndex = xlNone
Else
Selection.Interior.ColorIndex = 36
End If
Next
Range("j5").Select
Application.Calculation = xlCalculationAutomat

this sorts range from A to G and set color to each second row how can I include S column in this range
I mean that cells in column S are moved with cells from columns A to G.

## Sort 4 Columns By Comparing 2

Aug 8, 2014

I have column A which contains a range of part numbers, and column B is an On Hand quantity of that part number.

Column C is just like column A, in that it contains the same part numbers but it has about 1,000 additional part numbers that are obsolete. Column D has the On Hand quantity for Column C.

Column A and B are old information as far as the On Hand quantities, where Column C and D are up to date On Hand. The problem is the old outdated part numbers in column C.

How do I make column A and column C match, but not lose their respective On Hand quantities? I know this sounds discombobulated, but basically I need column A's part numbers, with column D's on hand quantity.

## 2 Columns Table Without Using SORT

Mar 1, 2009

I have some table with 3 columns: Name, Team, Players with the same name

I want to get to a 2 columns table without using "SORT" or something like that... using only formulas.

Maybe I wasn't so clear so I added a file with my problem.

## Sort Like Numbers In 2 Different Columns

May 4, 2009

I have 3 columns; A:Name, B:Debit & C:Credit. There are multiple row (approx 15,000) where I have a customer name and then a debit at one date, and a credit at another date. There is a debit to match every credit.

I would like to some how sort the sheet so that I can make sure each credit matched the debit. That way I can find what debit's don't match the credits. This is an example of how this looks. http://i303.photobucket.com/albums/n...kejoe/sort.jpg. I would like to sort it like the example on the far right (see attached picture)

## How To Sort Two LARGE Columns

Oct 11, 2013

I have a list of domains (about 200,000) that looks like this:

I have a list of urls (about 1 million) that looks like this:

I want my results to only show this (since this is the only thing in the second file that does not contain anything from the first file):

I have tried programs designed to do this but they either (a) shorten everything down to the domain or (b) wont remove anything since the domains are part of a longer url in the second file.

## Sort / Shuffle Certain Columns For Given Row

Mar 2, 2014

I feel like this should be somewhat simple, but none of the normal methods I know seem to work. I want to set up a formula (not a basic sort, since I want it to automatically correct every time I change information) so that for each row, several columns re-sort by date.

For instance, I have the following table:

Item Type Dates

A DV 5/2/14 6/12/14 7/11/15
B DS 3/11/13 6/19/14 1/2/15
C LG 11/12/14 8/1/15 1/12/16
...

where each of the dates is in a new column, but the "Dates" title is merged between the cells

I want to be able to resort just the date columns(/cells) for each row if a new date is written. I want the dates to be in ascending order. For instance, if I go back into the worksheet and replace Item A's date 5/2/14 with 1/1/16, I want the date columns JUST FOR Item A to reshuffle/resort to be:

A DV 6/12/14 7/11/15 1/1/16

without it resorting any other rows (Items) columns.

## Macro / VBA To Use 2 Columns In 1 Sort

May 13, 2013

I am trying to write a Macro to basically do a lot of redundant formatting for me and I am stuck on one part of this code. Everything else works just dandy, but I am having the darndest time getting this Macro to sort by 2 columns instead of just 1.

I did the basic first step and recorded myself sorting the datasheet by both columns in 1 sort and got the code, but the problem is that the number of rows will change day-to-day, week-to-week, and so on, so I need it to not specify a cell number as the end of the range.

While searching around, I saw a very handy little piece of VBA code that will search for a header name, which is really nice because that would make it much easier to share this Macro with my coworkers who have different reports that all have columns in different locations.

So, I have a multi-part question. I will start with the most important one:

How do I alter this to not specify A9590 and D9590 as the last cells in those ranges?

ActiveWorkbook.Worksheets("Date XREF").Sort.SortFields.Clear
"A6:A9590"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
"D6:D9590"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal

[code]....

Is there a way to have the Macro find where the header row is? The header rows in our reports can appear anywhere from Row 1 to Row 8 depending on how the report is set up (usually we have some information about the data, date range, etc at the top).

Dim c As Integer
With ActiveWorkbook.Worksheets("Date XREF").Range("A5").CurrentRegion
c = .Find(What:="Assignment ID", After:=.Cells(1, 1), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Column
.Sort Key1:=.Cells(1, c), Order1:=xlDescending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With