E
E
EVGENIJ NEFEDOV2018-11-01 12:18:35
excel
EVGENIJ NEFEDOV, 2018-11-01 12:18:35

How to leave only letters and numbers in a column?

There is a column in Excel with articles, and I need to leave only letters and numbers in it and remove the rest of the characters, how can I do this if I'm not a programmer?
You can, of course, not in Excel, but copy it to a notepad, for example, akelpad or notepad ++ and do something there, just what?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2018-11-01
@nefedovgeka

Open macro editor (Alt+F11)
Add new module
add custom function

Public Function SanitizeCharDigit(ByRef rng As Range) As String
    Dim pattern As String
    Dim replace As String
    Dim RegExp As Object    'Для регулярных выражений

    pattern = "[^A-Z\d]"
    replace = ""

    Set RegExp = CreateObject("VBScript.RegExp")
    With RegExp
        .Global = True    'Находим ВСЕ совпадения или только первое
        .IgnoreCase = True    'Учитываем ли регистр?
        .MultiLine = True    'Может ли паттерн попадать на разрывы строк?
        .pattern = pattern    'Выражение
    End With

    On Error Resume Next
    SanitizeCharDigit = RegExp.replace(CStr(rng.Value), replace)    'Поиск и замена

    Set RegExp = Nothing    'Очистка памяти от ненужного мусора

End Function

on the sheet in the desired cell, call this function
= SanitizeCharDigit (A1)
instead of "A1" insert your cell
will clear EVERYTHING except English letters and numbers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question