Try this UDF which will work with N number of permutation combination.
Function SpecificTitleCase(v As Variant) 'By :) Sixthsense :)
Dim vSplit As Variant, iLoc As Integer, i As Integer
Dim sTemp As String, sConv As String, sData As String
vSplit = Split(v, ",")
For i = LBound(vSplit) To UBound(vSplit)
sTemp = vSplit(i)
iLoc = InStr(sTemp, "=")
If iLoc Then
sConv = StrConv(Mid(sTemp, iLoc + 1, 255), vbProperCase)
sConv = Left(sTemp, iLoc) & sConv
sData = sData & sConv & ", "
Else
sData = sData & sTemp & ", "
End If
Next i
SpecificTitleCase = sData
If Len(sData) > 0 Then SpecificTitleCase = Left(sData, Len(sData) - 2)
End Function
Formula:
=SpecificTitleCase(A2)
Or
Formula:
=SpecificTitleCase("CA=CALIFORNIA, NY=NEW YORK, FL=FLORIDA")
How to install your new code
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
Bookmarks