Question

Ive got some items of text in Excel and id like to capitalise the first letter of each word. However, a lot of text contains the phrase 'IT' and using current capitalisation methods (PROPER) it changes this to 'It'. Is there a way to only capitalise the first letter of each word without DE capitalising the other letters in each word?

Was it helpful?

Solution

Here is a VBA way, add it to a module & =PrefixCaps("A1")

Public Function PrefixCaps(value As String) As String
    Dim Words() As String: Words = Split(value, " ")
    Dim i As Long
    For i = 0 To UBound(Words)
        Mid$(Words(i), 1, 1) = UCase$(Mid$(Words(i), 1, 1))
    Next
    PrefixCaps = Join(Words, " ")
End Function

OTHER TIPS

Used the website http://www.textfixer.com/tools/capitalize-sentences.php and pasted it all in instead

That was all a bit complicated, but I did find if your spreadsheet is pretty simple, you can copy and paste it into word and use it's editing features and then copy and paste that back in to Excel. Worked quite well for me.

Fixes double spaces in the text:

    Public Function PrefixCaps(value As String) As String
    Dim Words() As String: Words = Split(value, " ")
    Dim i As Long
    For i = 0 To UBound(Words)
        If Len(Words(i)) > 0 Then
            Mid$(Words(i), 1, 1) = UCase$(Mid$(Words(i), 1, 1))
        End If
    Next
    PrefixCaps = Join(Words, " ")
End Function`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top