You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Combining spreadsheets

I have two spreadsheets I'm trying to combine. One has a list of names in the Column A with associated dates of birth in Column B, the other has a list of names in Column A with diagnostic codes in Column B. Not all names are on both lists. I'm trying to combine the data on these two spreadsheets to end up with one where the rows contain a name in column A, that person's date of birth in column B and that person's codes in Column C. Any help? I'm new-ish to Numbers.... Thanks!

MacBook Air (2020 or later)

Posted on Jan 4, 2022 1:39 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 4, 2022 2:46 PM

It depends. First thing is to copy the two tables into a single new document.

  1. Create a new document. Delete the default table. Create a second sheet and delete the table there, too
  2. Open the "date of birth" document
  3. Select the table and Copy
  4. Paste it into Sheet 1 of the new document
  5. Repeat 2-4 for the "codes" document but paste into Sheet 2


Next get all the names into one table. There will be duplicates but that will be dealt with later.

  1. Create a third sheet. Keep the table this time
  2. Copy the column of names from the table on Sheet 1and Paste to column A of this table (select cell A2 then Paste)
  3. Add a row to the bottom of the table if there is not a blank row at the bottom
  4. Copy the column of names from the table on Sheet 2 and Paste into column A of this table (select the blank cell at the bottom of column A then Paste)


Next get the birthdates and codes into the table. I will be using the name "Table 1" as the names of the two tables you copy/pasted into this document. If they have a different name, use those names instead.

  1. In cell B2 put the formula =XLOOKUP(A, Sheet 1::Table 1::A,Sheet 1::Table 1::B,"",0)
  2. In cell C2 put the formula =XLOOKUP(A, Sheet 2::Table 1::A,Sheet 2::Table 1::B,"",0)
  3. Select both of those cells.
  4. Copy
  5. Select the rest of columns B&C
  6. Paste


That should have created a table with the names with their associated birthdates and codes. Sort the table by column A to get everything into alphabetical order by name. There will likely be duplicate rows. Manually deleting the duplicate rows might be the quickest way to pare it down, depending on how many you have. If you have a lot of them to delete, formulas can be used to flag them then they can be sorted into one block for one quick deletion. Here is the manual way though:

  1. Click on the row number to select a row
  2. Command click on row numbers of other rows to delete to select those other rows.
  3. When you have a few selected to delete, right click and choose "delete selected rows".


Replace the formulas with their values.

  1. Select columns B & C (all the cells with formulas)
  2. Copy
  3. Use the menu item "Edit->Paste Formula Results" . All the formulas should be gone and the values there instead.
  4. Sheets 1 and 2 and the tables on them are no longer required. You can delete them and rename Sheet 3 as Sheet 1 (or whatever name of your choosing)


2 replies
Question marked as Top-ranking reply

Jan 4, 2022 2:46 PM in response to Boisturej

It depends. First thing is to copy the two tables into a single new document.

  1. Create a new document. Delete the default table. Create a second sheet and delete the table there, too
  2. Open the "date of birth" document
  3. Select the table and Copy
  4. Paste it into Sheet 1 of the new document
  5. Repeat 2-4 for the "codes" document but paste into Sheet 2


Next get all the names into one table. There will be duplicates but that will be dealt with later.

  1. Create a third sheet. Keep the table this time
  2. Copy the column of names from the table on Sheet 1and Paste to column A of this table (select cell A2 then Paste)
  3. Add a row to the bottom of the table if there is not a blank row at the bottom
  4. Copy the column of names from the table on Sheet 2 and Paste into column A of this table (select the blank cell at the bottom of column A then Paste)


Next get the birthdates and codes into the table. I will be using the name "Table 1" as the names of the two tables you copy/pasted into this document. If they have a different name, use those names instead.

  1. In cell B2 put the formula =XLOOKUP(A, Sheet 1::Table 1::A,Sheet 1::Table 1::B,"",0)
  2. In cell C2 put the formula =XLOOKUP(A, Sheet 2::Table 1::A,Sheet 2::Table 1::B,"",0)
  3. Select both of those cells.
  4. Copy
  5. Select the rest of columns B&C
  6. Paste


That should have created a table with the names with their associated birthdates and codes. Sort the table by column A to get everything into alphabetical order by name. There will likely be duplicate rows. Manually deleting the duplicate rows might be the quickest way to pare it down, depending on how many you have. If you have a lot of them to delete, formulas can be used to flag them then they can be sorted into one block for one quick deletion. Here is the manual way though:

  1. Click on the row number to select a row
  2. Command click on row numbers of other rows to delete to select those other rows.
  3. When you have a few selected to delete, right click and choose "delete selected rows".


Replace the formulas with their values.

  1. Select columns B & C (all the cells with formulas)
  2. Copy
  3. Use the menu item "Edit->Paste Formula Results" . All the formulas should be gone and the values there instead.
  4. Sheets 1 and 2 and the tables on them are no longer required. You can delete them and rename Sheet 3 as Sheet 1 (or whatever name of your choosing)


Combining spreadsheets

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.