Home > Net >  to remove text from a sentence in excel after numerics
to remove text from a sentence in excel after numerics

Time:09-10

I have tried a lot but could not find a way to remove the text from a cell after first numeric.

Let suppose there is a name of a file mentioned in excel where i would like to remove the remaining part of file name after the date (i.e. remove text right right side after date)

the formula i am using is =LEFT(A3,SEARCH("1",A3)-1)

in this formula it deletes the text after numeric 1 however there are many names where i have different numeric mentioned, therefore i could not find any solution so far

please see example below

enter image description here

Can anyone please advise if there any method to remove the text from right after every first numeric.

i will be thankful

CodePudding user response:

You can use this formula:

=LEFT(A2,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A2 & "1234567890"))-1)

Assuming that your names are in column A.

MIN(FIND({1,2,3,4,5,6,7,8,9,0},A2 & "1234567890")) returns the first = MIN position of each numerical value (1, 2, 3...)). To assure that each figure occurs at least once "1234..." is added to the string to be checked.

LEFT obviously returns the left part of the string.

  • Related