How to quickly find the position of first uppercase in Excel text string?
Supposing there is a list of text strings mixed with numbers, uppercase and lowercase letters, how can you quickly find the position of first uppercase letter from the strings? In this article, I introduce the tricks which can quickly specify the position of first upper case without counting them one by one manually in Excel.
Here is a formula which can help you quickly find the position of first uppercase from string, please do as below:
Select a blank cell next to the string you want to find the first uppercase, B1 for instance, enter this formula =MIN(IF(ISERROR(FIND(CHAR(ROW(INDIRECT("65:90"))),A1)),"",FIND(CHAR(ROW(INDIRECT("65:90"))),A1)))
Press Shift + Ctrl + Enter key to get the correct result, and then drag the auto fill handle over the cells which needed to apply this formula. See screenshot:
Except formula, you also can use Defined Function to find out the position of first uppercase in the string.
1. Enable the sheet which contains the string you want to find uppercase, and press Alt + F11 keys to open Microsoft Visual Basic for Applications window.
2. ight click at the sheet you want to use the code in Project Explore pane, and click Insert > Module, and paste below code to the blank Module script. See screenshot:
Code: Find position of first uppercase from string.
Function GetFirstUpper(Rg As Range) As Integer 'UpdatebyExtendoffice20160726 Dim xStr As String Dim I As Integer Application.Volatile GetFirstUpper = -1 On Error Resume Next xStr = Trim(Rg.Value) For I = 1 To Len(xStr) If (Asc(Mid(xStr, I, 1)) < 91) And (Asc(Mid(xStr, I, 1)) > 64) Then GetFirstUpper = I Exit Function End If Next End Function
3. Save the code and go back to the sheet you use, and select a blank cell next to the string you want to find uppercase, enter this formula =GetFirstUpper(F1), press Enter key, and then drag autofill handle over cells needed this formula. See screenshot:
Tip: If there is no uppercase in the string, the result displays as -1.
In general Excel work, you may usually need to change letter strings to UPPERCAEs, Proper Case, lowercase, Sentence case or ToGgLe CaSe as below screenshot shown.
With Kutools for Excel, you can apply its Change Case utility to quickly change the letter case as you need.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the strings you want to change their cases, and click Kutools > Text > Change Case. See screenshot:
2. Then in the popping Change Case dialog, check the option you want in the Change type section, and you can preview the changing result in the Preview pane. See screenshot:
3. Then click Ok or Apply to change case.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!