I had this question after viewing How to add a parameter to this custom function for the number of columns?
Function CombineText(rg As Range) As String
Dim col As Integer
If rg.Rows.Count = 1 Then
For col = 1 To rg.Columns.Count
If rg.Cells(1, col) = "" Then
CombineText = CombineText & "00"
CombineText = CombineText & Left(rg.Cells(1, col), 2)
If col < rg.Columns.Count Then
CombineText = CombineText & "-"
In this function, the first three characters of cells are in the format "01-", "02-", etc. is picked up from cells from a number of columns. I would now like to convert the "01-" to A, "02-" to B, etc. There are no numbers above 26. If a cell is blank, I would like its value to "X".