Is it possible to adjust the capitalization of a large amount of data at one time?

mimih23

Board Regular
Joined
Oct 14, 2010
Messages
89
Hello!
I have a spreadsheet with over thousands of names and addresses and would like to format the way the information is listed. Here is an example:

John DOE
JOHN DOE
john doe
john Doe

I would like to be able to format them so that they each appear as such:

John Doe

Is that possible without having to manually update each record???? Any help would be greatly appreciated!! Thanks!!:):confused::):eeek:
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I have a slightly different macro, similar to Chip Pearson's (as cited above by Andrew Poulsom), but my version will cycle through the various cases on each call.

Code:
Sub Caps()
'Toggle case of selection.
    Dim curSel As Range, r as Range 
    Static curCap%, prevSel As Range
 
    On Error Resume Next
    Set curSel = Intersect(Selection, Cells.SpecialCells(xlCellTypeConstants, xlTextValues))
    If curSel Is Nothing Then Exit Sub
 
    'Errors if curSel not same or subset of prevSel.
    'Fine to ignore, since curSel.Count <> Nothing (took care of that above).
    curCap = IIf(curSel.count <> Intersect(prevSel, curSel).count, 0, (curCap + 1) Mod 3)
    On Error GoTo 0
 
    For Each r In curSel
        Select Case curCap
            Case 0: r.Value = UCase(r.Value)
            Case 1: r.Value = StrConv(r.Value, vbProperCase)
            Case 2: r.Value = LCase(r.Value)
        End Select
    Next
 
    Set prevSel = curSel
End Sub
 
Last edited:
Upvote 0
Oh my gosh you guys are awesome!! Will these macros work on addresses or cells in general filled with several amounts of text:

Example:
123 ambrook st. 123 Ambrook St.
123 AMBROOK st 123 Ambrook St.

Thoughts?

Thanks!
 
Upvote 0
Oh I tried the =Proper() and that worked on the addresses. Yeah! I love this forum!

Thanks everyone!
 
Upvote 0
PROPER() does a great job, but you still have to look through your data to make sure the function designates the upper and lower cases correctly. I work with a lot of names and addresses and have found many instances where proper did exactly what it was asked to do--but it left a few things behind that were not ideal.

"O'BRIEN" will properly capitalize to "O'Brien" , but "OBRIEN" (no apostrophe) will become "Obrien". And watch for names like "MACMURRAY" that should be "MacMurray". Same holds true with surnames with "Mc" at the start.

Similar issues arise when you have "PO BOX", "P.O. BOX", "P O BOX" and street names like "37TH Street", which becomes "37Th Street" when it should be "37th Street".

HTH
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,839
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top