Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Concatenate Two Unique Lists Excluding Blanks

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can concatenate two unique lists in Excel and exclude blanks by using the UNIQUE function combined with TEXTJOIN. This method combines data from multiple columns into a single column, removing any empty cells automatically. You will need a modern version of Excel (Office 365 or Excel 2021) that supports dynamic array functions, as older versions do not have the UNIQUE or TEXTJOIN capabilities built-in.

What You'll Need

  • Excel 365 or Excel 2021: This guide uses the UNIQUE and TEXTJOIN functions, which are only available in these newer versions. If you have an older version, you will need to use a different method involving helper columns and manual filtering.
  • Data in Two Columns: Ideally, your data is already in two separate columns, such as Column A and Column B. The lists do not need to be sorted or unique beforehand; the UNIQUE function will handle that.
  • A Destination Cell: A blank cell where you want the concatenated, unique, non-blank result to appear.
  • Basic Understanding of Functions: Familiarity with entering formulas into cells and understanding the concept of arrays (lists of values) is helpful.

Step-by-Step

  1. Identify Your Data Ranges: First, determine the exact range of cells for your two lists. For example, if your first list is in cells A1 through A10 and your second list is in cells B1 through B10, you will be working with these ranges. It is important to note that these ranges do not need to be the same size.
  2. Select the Destination Cell: Click on the blank cell where you want the final, combined list to appear. This cell should be outside of the data ranges to avoid overwriting any existing information.
  3. Enter the TEXTJOIN Function: In the selected cell, start typing the formula with an equals sign: =TEXTJOIN(...). The TEXTJOIN function is designed to combine text from a range of cells with a specified delimiter.
  4. Specify the Delimiter: The first argument of the TEXTJOIN function is the delimiter. This is the character or string that will separate the items in your final list. For a simple list, you can use a comma and a space: ",". If you want the items to be on separate lines, you can use a line break character: "#10" (for Windows) or "#13#10" (for Mac). For this guide, we will use the comma and space.
  5. Specify the Ignore Empty Argument: The second argument of the TEXTJOIN function is the ignore_empty argument. This is a crucial step for excluding blanks. Set this argument to TRUE. This tells Excel to skip over any empty cells in the range you are joining, ensuring that your final list contains no blanks.
  6. Enter the UNIQUE Function: The third argument of the TEXTJOIN function is the text1 argument, which is the range or array of text you want to join. Instead of entering the range directly, you will nest the UNIQUE function inside TEXTJOIN. Start typing UNIQUE(...). The UNIQUE function will take your two lists and extract only the unique values from them.
  7. Combine the Lists into the UNIQUE Function: To combine the two lists into the UNIQUE function, you need to create a combined range. You can do this by using the CONCATENATE function or simply by typing the two range references separated by a comma. For example: UNIQUE(A1:A10, B1:B10). This will create a single array containing all values from both lists.
  8. Close the Parentheses: Once you have the UNIQUE function set up to handle your combined range, close the parentheses of the UNIQUE function. Then, close the parentheses of the TEXTJOIN function. Your formula should now look something like this: =TEXTJOIN(",", TRUE, UNIQUE(A1:A10, B1:B10)).
  9. Press Enter: Press the Enter key on your keyboard to execute the formula. Excel will calculate the result and display the concatenated, unique, non-blank list in the destination cell. The formula will automatically spill down to fill adjacent cells if there is space, displaying the unique items in a dynamic array format.
  10. Verify the Results: Look at the result to ensure it meets your expectations. Check that there are no blank cells, that all items from both original lists are present, and that there are no duplicates. If the result looks correct, you can now use this list for further analysis or reporting.

Common Mistakes

One of the most common mistakes when using this method is not ensuring that the ignore_empty argument in the TEXTJOIN function is set to TRUE. If you forget this step, Excel will still include empty cells in the final result, which defeats the purpose of excluding blanks. Another mistake is not using the correct delimiter. A comma is the standard delimiter, but if you are joining numbers or dates, you might prefer to use a space or no delimiter at all. Be sure to choose the delimiter that best suits your data and the desired output format.

Tips

When working with large datasets, it is important to be mindful of performance. The UNIQUE and TEXTJOIN functions are powerful, but they can be computationally expensive if applied to very large arrays. If you find that your workbook is slowing down, try breaking your data into smaller chunks or using helper columns to pre-process the data. Another useful tip is to use spill ranges to your advantage. When you enter a dynamic array formula like TEXTJOIN(UNIQUE(...)), Excel will automatically fill adjacent cells with the results. You can drag these spill ranges to other parts of your sheet or use them as data sources for other formulas.

Troubleshooting

If the formula returns a #NAME? error, it means that your version of Excel does not support the UNIQUE or TEXTJOIN functions. You will need to upgrade to Excel 365 or Excel 2021 to use this method. If the formula returns a #VALUE! error, it usually means that one of the ranges you referenced contains non-text data. The TEXTJOIN function expects text, so if you are trying to join numbers or dates, you may need to convert them to text first using the TEXT function.

Frequently Asked Questions

Can I concatenate lists with different numbers of items?

Yes, you can. The UNIQUE function can handle arrays of different sizes. For example, if List A has 10 items and List B has 5 items, the combined range will consist of 15 items, and the UNIQUE function will process all of them.

What if my data contains special characters like commas or semicolons?

Yes, you can. The UNIQUE function can handle arrays of different sizes. For example, if List A has 10 items and List B has 5 items, the combined range will consist of 15 items, and the UNIQUE function will process all of them.

Does this method work with text and numbers mixed together?

Yes, but you may need to convert the numbers to text first. The TEXTJOIN function expects text, so if you try to join numbers directly, you will get an error. You can use the TEXT function to convert numbers to text, or you can wrap the numbers in double quotes in the formula.

How do I update the formula if I add new data to the original lists?

Once the formula is set up, it is dynamic. If you add new data to the original lists, the formula will automatically update to include the new items in the final result. You do not need to edit the formula manually.

Can I use this method to concatenate lists from different sheets?

Yes, you can. You can reference ranges from different sheets in the formula. For example, =TEXTJOIN(",", TRUE, UNIQUE(Sheet1!A1:A10, Sheet2!B1:B10)). This will combine the unique items from both lists, regardless of which sheet they are on.

What happens if there are duplicates within a single list?

The UNIQUE function will remove duplicates within each individual list before combining them. This ensures that the final result contains no duplicates at all, even if the same value appears multiple times in the same original list.