In essence, my Excel Spreadsheet has a number of strings that are organised as follows:

```JOHN-MD-HOPKINS
REC-PW-RESIN
```

I would like to use the proper function but exclude the part of the string that is within the dashes (-).

The end result should look like the following:

```John-MD-Hopkins
Rec-PW-Resin
```

Is there an excel formula that is capable of doing this?

Oct 21, 2022 in Others 233 views

## 1 answer to this question.

To accomplish this, you might need to write your own VBA code that first determines whether the data contains two hyphens and, if so, only changes the first and last words to the correct case, leaving the middle word alone.

Paste the following into a module within Excel:

```Function fProperCase(strData As String) As String
If UBound(aData) - LBound(aData) = 2 Then   '   has two hyphens in the original data
Else    '    just do a normal string conversion to proper case
fProperCase = StrConv(strData, vbProperCase)
End If
End Function```

When that happens, you can use this formula in your worksheet just like you would any built-in formula. For example, if "JOHN-MD-HOPKINS" is in cell A1, you can use this formula in another cell as follows:

```=fProperCase(A1)
```

Which would display John-MD-Hopkins as required.

• 63,160 points

## IF function in combination with an Round function Excel

I'm not sure if it is a ...READ MORE

## Using Excel VLOOKUP() function across two sheets

The syntax for VLOOKUP is VLOOKUP(Lookup_Value,Table Array,Col_index_num,Range_lookup) OR, to start in ...READ MORE

## Calculate Birthdate from an age using y,m,d in Excel

Hi To Calculate the date, we can ...READ MORE

## Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

## IF - ELSE IF - ELSE Structure in Excel

In this case, you can use nested ...READ MORE