# 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](/files/-LnsU-QMZhWZhrcPHO03)

![2017 US Football Attendance](/files/-LnsTym4fPDWs0H4GiEn)

### 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!

![](/files/-LnsUh4NYGp5uPIdkeAL)

### Step 2: Better Alignment

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

![](/files/-LnsV87igBzwL038iBdC)

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](/files/-LnsVcqXraYYXQAm0vI4)

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:

![](/files/-LnsWzDCRsM_J2eNDw93)

### 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.](/files/-LnsZ5N9JJmVunN_PNEH)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beyondcompare.gitbook.io/project/table-compare/the-columns-on-my-two-tables-dont-match.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
