Manually merging text columns while isolating only uppercase letters is a tedious, error-prone hurdle for data analysts seeking clean datasets. While standard funding sources for enterprise IT modernization often overlook these daily operational inefficiencies, mastering advanced spreadsheet formulas grants users immediate data-formatting autonomy without the need for expensive software procurement.
However, note the stipulation: native Excel lacks a direct "IsUpper" filter, requiring a strategic, nested array approach to isolate case-sensitive characters. Organizations successfully leverage this method for consolidating disparate regional SKU codes across global departments. Below, we will break down the exact combination of TEXTJOIN, MID, and EXACT formulas to automate this concatenation.
Data cleaning and preparation are some of the most common tasks performed in Excel. Often, you may find yourself needing to extract specific patterns of text from your datasets to generate unique keys, IDs, abbreviations, or initials. One particularly common requirement is extracting and concatenating only the uppercase letters from two different columns.
For example, if Column A contains "John DOE" and Column B contains "Sales Manager", you might want to extract the uppercase letters to create an identifier like "JDOESM". Because Excel does not have a built-in EXTRACTUPPERCASE function, achieving this requires combining several functions to inspect each character, check if it is uppercase, and join them back together.
In this comprehensive guide, we will explore the best methods to concatenate uppercase letters from two columns, ranging from modern Excel 365 formulas to traditional array formulas, Power Query, and VBA solutions.
Before diving into the formulas, let's visualize the expected output. Suppose we have a table with two columns, and we want to extract only the uppercase letters (A-Z) from both, merging them into a single string:
| Column A (Source 1) | Column B (Source 2) | Desired Output (Concatenated Uppercase) |
|---|---|---|
| John Smith | Project Manager | JSPM |
| NYC_Office | Floor_02_DEPT | NYCODEPT |
| alphaBeta | GammaDelta | BGD |
If you are using Excel 365 or Excel 2021, you have access to powerful dynamic array functions like LET, MAP, SEQUENCE, and LAMBDA. These functions make it incredibly straightforward to split a string into individual characters, filter them based on their character codes, and join them back together.
=LET(
combinedString, A2 & B2,
stringLength, LEN(combinedString),
characters, MID(combinedString, SEQUENCE(stringLength), 1),
TEXTJOIN("", TRUE, MAP(characters, LAMBDA(char, IF(AND(CODE(char) >= 65, CODE(char) <= 90), char, ""))))
)
combinedString, A2 & B2: First, we use the LET function to define variables. We concatenate the text in cells A2 and B2 into a single string.stringLength, LEN(combinedString): We calculate the total length of this combined string.characters, MID(...): Using SEQUENCE(stringLength), we generate an array of numbers from 1 to the length of the string. The MID function uses this array to split our combined string into an array of individual characters.MAP(characters, LAMBDA(...)): The MAP function inspects each individual character (represented as char).CODE(char): This is the secret to case sensitivity in Excel. The CODE function returns the numeric ASCII value of a character. In ASCII, uppercase letters 'A' through 'Z' range from 65 to 90. Lowercase letters, spaces, numbers, and special characters fall outside this range.IF(AND(CODE(char) >= 65, CODE(char) <= 90), char, ""): If the character's ASCII code is between 65 and 90, we keep it; otherwise, we replace it with an empty string ("").TEXTJOIN("", TRUE, ...): Finally, TEXTJOIN merges the filtered array of characters back into a single string, skipping any empty cells.If you are using an older version of Excel that supports TEXTJOIN but does not support dynamic arrays like MAP or LAMBDA, you can use a classic array formula.
Enter the following formula and press Ctrl + Shift + Enter (if you are not on Excel 365):
=TEXTJOIN("", TRUE, IF(ISNUMBER(MATCH(CODE(MID(A2&B2, ROW(INDIRECT("1:"&LEN(A2&B2))), 1)), ROW(INDIRECT("65:90")), 0)), MID(A2&B2, ROW(INDIRECT("1:"&LEN(A2&B2))), 1), ""))
ROW(INDIRECT("1:"&LEN(A2&B2))) generates a static array of numbers corresponding to the position of each character.MID(A2&B2, ..., 1) extracts each character one by one.CODE(...) converts each character to its ASCII code.MATCH(..., ROW(INDIRECT("65:90")), 0) checks if the ASCII code matches any number in the range of 65 to 90 (the ASCII values for A-Z).IF function returns that character; otherwise, it returns an empty string.TEXTJOIN glues the matching uppercase characters together.If you are working with large datasets containing thousands of rows, executing complex array formulas can slow down your workbook. Power Query is the most efficient tool for this scenario. It provides a clean, visual way to manipulate text without writing long formulas.
Merged).Text.Select([Merged], {"A".."Z"})
Merged column.If you are working on a very old version of Excel that lacks the TEXTJOIN function entirely, your best option is to write a short User-Defined Function (UDF) using VBA.
To add this code to your workbook:
ALT + F11 to open the VBA Editor.Insert > Module.Function ConcatenateUpper(cell1 As Range, cell2 As Range) As String
Dim combined As String
Dim i As Long
Dim charCode As Integer
Dim result As String
combined = cell1.Value & cell2.Value
result = ""
For i = 1 To Len(combined)
charCode = Asc(Mid(combined, i, 1))
' ASCII 65 to 90 represents uppercase letters A to Z
If charCode >= 65 And charCode <= 90 Then
result = result & Mid(combined, i, 1)
End If
Next i
ConcatenateUpper = result
End Function
Once you close the VBA window, you can use this function just like a regular Excel formula:
=ConcatenateUpper(A2, B2)
To help you choose the best option for your specific setup, here is a quick breakdown of each method:
| Method | Excel Compatibility | Performance | Complexity |
|---|---|---|---|
| Excel 365 Dynamic Formula | Office 365 / Excel 2021+ | Fast | Medium |
| Classic Array Formula | Excel 2016 / 2019 | Medium (Can lag on huge sheets) | High |
| Power Query | Excel 2010 and newer | Excellent (Best for millions of rows) | Low (Visual UI) |
| VBA Macro / UDF | All Excel versions | Fast | Requires Macro-enabled workbook (.xlsm) |
Extracting and concatenating uppercase letters from two columns is a highly effective way to parse messy text data into clean, structured abbreviations or identifiers. If you are on Excel 365, the LET and MAP combination is the cleanest, most responsive solution available. For legacy versions or massive datasets, Power Query and VBA provide reliable, high-performance alternatives.
Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.