NEED A FUNCTION oppersite from PROPER

vi3tboiz15

New Member
Joined
Aug 3, 2011
Messages
1
NEED A FUNCTION oppersite from PROPER
<hr style="color: rgb(235, 235, 235); background-color: rgb(235, 235, 235);" size="1"> I need help!!! I want to do do the completely opposite of the function PROPER

A1 = HI MY NAME IS TOM

=PROPER(A1) --> Hi My Name Is Tom

I need a function that can Inverse this into --> hI mY nAME iS tOM

Example

A1 = AGJKHELKJHKLWSDJFK

I need a function that can do

A1 = aGJKHELKJHKLWSDJFK

progress.gif
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Welcome to the forum!

Code:
Sub Test_IMProper()
  Dim s As String
  s = "HI MY NAME IS TOM"
  [A1] = s
  [A1] = IMProper(s)
End Sub

'=IMProper(A1)
Function IMProper(aString As String) As String
  Dim i As Integer, s As String, ss As String
  aString = WorksheetFunction.Proper(aString)
  For i = 1 To Len(aString)
    s = Mid(aString, i, 1)
    If LCase(s) = s Then
      s = UCase(s)
      Else: s = LCase(s)
    End If
    ss = ss & s
  Next i
  IMProper = ss
End Function
 
Upvote 0
Welcome to the board!

If you have the morefunc add-in, you could do something like:

Code:
=MCONCAT(IF(EXACT(MID(PROPER(A1),ROW(INDIRECT("1:"&LEN(B1))),1),UPPER(MID(PROPER(A1),ROW(INDIRECT("1:"&LEN(B1))),1))),LOWER(MID(PROPER(A1),ROW(INDIRECT("1:"&LEN(B1))),1)),UPPER(MID(PROPER(A1),ROW(INDIRECT("1:"&LEN(B1))),1))))

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
Code:
Function IMPROPER(r As String) As String
Dim t, x As Long
t = Split(r)
For x = LBound(t) To UBound(t)
    t(x) = LCase(Left(t(x), 1)) & UCase(Mid(t(x), 2))
Next x
IMPROPER = Join(t)
End Function
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

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