# Mismatched Columns

### Help!  My Columns Don't Match!

We want to compare the attendance for Football and Baseball by city, as shown in the two Excel files below.  Unfortunately, our two data tables have different columns and their order is chaotic. Here are the two tables, opened in Excel:

![2017 US Baseball Attendance](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsS9_fW4oFGP1UiVAV%2F-LnsU-QMZhWZhrcPHO03%2Fimage.png?alt=media\&token=3c511b75-7174-400d-8ba5-2a54379123ee)

![2017 US Football Attendance](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsS9_fW4oFGP1UiVAV%2F-LnsTym4fPDWs0H4GiEn%2Fimage.png?alt=media\&token=aca30014-a8fb-47e7-af52-8c055273c9ce)

### Step 1: Poor Alignment

When you first open these two tables in Beyond Compare, they will not align at all and you will complain that you want a refund on BC!

![](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsS9_fW4oFGP1UiVAV%2F-LnsUh4NYGp5uPIdkeAL%2Fimage.png?alt=media\&token=4b94f9c1-3552-42e7-97f9-fc9ea0d5013a)

### Step 2: Better Alignment

Go to `Rules->Columns`.  Use the arrow keys to slide the column headers up and down.

![](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsS9_fW4oFGP1UiVAV%2F-LnsV87igBzwL038iBdC%2Fimage.png?alt=media\&token=c8ba80df-01d9-4603-a648-2d17d513eb66)

Also, you can hide some columns, giving the result below, where the marked in red are now hidden (we hid them because they were irrelevant to our comparison).

![Blue: The result of using the green arrows  Red: The result of rightclicking 'Hide' on the irrelevant columns](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsS9_fW4oFGP1UiVAV%2F-LnsVcqXraYYXQAm0vI4%2Fimage.png?alt=media\&token=03a1ebb1-e138-4195-a50f-5de02056c498)

The alignment looks better but the key columns are still not ideal.  This is because Beyond Compare is naively using Column 1 to do the "[join](http://www.sql-join.com/sql-join-types)". By default, BC will select Column 1 as the key column. The result looks okay, but not great, below:

![](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsVxOHCr1OJRWvX0LA%2F-LnsWzDCRsM_J2eNDw93%2Fimage.png?alt=media\&token=1e14f1dd-da31-4726-8a5d-f2ab357c6083)

### Step 3: Best Alignment

By default, BC will select Column 1 as the key column. In this case, we might want to join instead on City. You can rightclick any column heading that you want to set as a Key column.  We can now make some interesting conclusions.  For example, Minneapolis attendance is ranks better in its baseball league than in its football league. Whereas Dallas seems to like their football team more than their baseball team.

![Football and Baseball Attendance tables joined by city name.](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsX1Wbe7EVeS4x0awA%2F-LnsZ5N9JJmVunN_PNEH%2Fimage.png?alt=media\&token=1242bf84-513b-4550-9a98-6f1b3937225d)

