Share via

Put a space before each capital letter

Anonymous
2013-06-23T03:12:13+00:00

Hi,

IHaveSentencesThatAreAllRunTogetherAndEachNewWordIsACapitalLetter.

The information starts in column H7

Is there a formula that will keep the sentences in the same cell, but will put a space before each capital letter so that it looks like this?

I have sentences that are all run together and each new word is a capital letter. 

 If it can change the 1st letter back of each word back  to a lower case except for the beginning word, that would be great.... but I can work around  that if it doesn't. 

Thanks

Nana from NC

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Anonymous
    2013-06-23T03:49:41+00:00

    A quick macro would serve you best here even if you decide not to retain it for future use.

    Tap Alt+F11 and when the VBA opens, immediately use the pull-down menus to Insert, Module. Paste the following into the new pane titled something like BooK1 - Module1 (Code),

    Sub mcr_Fix_Case()

        Dim r As Range, s As String, c As Long

        For Each r In Selection

            s = vbNullString

            For c = 1 To Len(r.Value)

                s = s & IIf(Asc(Mid(r.Value, c, 1)) > 64 And _

    Asc(Mid(r.Value, c, 1)) < 91, _

    Chr(32), vbNullString) & Mid(r.Value, c, 1)

    Next c

    s = Trim(s)

            r = Left(s, 1) & Right(LCase(s), Len(s) - 1)

        Next r

    End Sub

    Tap Alt+Q to return to your worksheet. First select teh cells containing the run-on sentences then tap Alt+F8 to open the Macros dialog and Run the macro. It will convert every cell you selected from this,

    IHaveSentencesThatAreAllRunTogetherAndEachNewWordIsACapitalLetter.

    ... to this,

    I have sentences that are all run together and each new word is a capital letter.

    20+ people found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. Anonymous
    2013-06-24T09:36:02+00:00

    The best and quickest way is Macro, as suggested by Jeepad.

    I am trying to give one alternate (Non Macro Solution). Assuming your text is in H7, then give this formula at I7 and drag it right side till you start getting blank cell (or say till 200 columns).

    =IFERROR(IF(AND(CODE(MID($H7,COLUMN(A7),1))<91,CODE(MID($H7,COLUMN(A7),1))>64)," "&CHAR(CODE(MID($H7,COLUMN(A7),1))+32),MID($H7,COLUMN(A7),1)),"")&J7

    Your result will be at I7, you may hide the other columns.

    You may also drag down this formula.

    8 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2015-07-08T16:43:48+00:00

    Awesome!!! It worked like charm!

    3 people found this answer helpful.
    0 comments No comments