mdimond88
mdimond88

Reputation: 1

Find & Replace in excel

I am trying to do a mass find & replace in Microsoft excel. What I want to do is anywhere that there is a period i want to remove the first letter in front of it and everything else after it.

Example: Matt RyanM.Ryan

I want to remove the 'M.Ryan' so it just says 'Matt Ryan'. Is this even possible? If so how can it be done?

Upvotes: 0

Views: 51

Answers (3)

Gary's Student
Gary's Student

Reputation: 96753

This will process all the cells on a single sheet:

Sub noDot()
    Dim r As Range
    For Each r In ActiveSheet.UsedRange
        v = r.Value
        i = InStr(v, ".")
            If v <> "" And i <> 0 Then
                arr = Split(v, ".")
                If Len(arr(0)) < 2 Then
                    r.Value = ""
                Else
                    r.Value = Left(arr(0), Len(arr(0)) - 1)
                End If
            End If
        Next r
End Sub

Upvotes: 0

BigBen
BigBen

Reputation: 49998

Use ?.* as the find criterion: ? for one character before the period, and * for all characters after it:

BEFORE: enter image description here

AFTER: enter image description here

Upvotes: 1

Scott Craner
Scott Craner

Reputation: 152450

Use LEFT:

=LEFT(A1,FIND(".",A1)-2)

Upvotes: 0

Related Questions