PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 5, 2022

[FIXED] How to remove the integer behind the name if there is any? (google sheet)

 September 05, 2022     google-sheets, trim     No comments   

Issue

enter image description here

Hi everyone,

My goal is to remove the integer behind the name (if exist) as shown in the screenshot above. Is there any trick to do this other than doing it manually? It is challenging for me because the name list is not consistent as some of the names does not have integer behind. Any help will be greatly appreciated!


Solution

In your situation, how about the following sample formula?

Sample formula:

=ARRAYFORMULA(REGEXREPLACE(A3:A,"\d+$",""))

Result:

enter image description here

Note:

  • If you want to use TRIM for the value, how about =ARRAYFORMULA(TRIM(REGEXREPLACE(A3:A,"\d+$","")))?

Reference:

  • REGEXREPLACE

Added:

From OP's following replying,

Hi Tanaike, thanks for your input. I tested both formula. It works most of the time with the exception of Derrick Tan 1. Beside that, is it possible to remove the - as well if exist? I edited my question with new screenshot example, thank you.

In this case, how about the following sample formula?

Sample formula:

=ARRAYFORMULA(TRIM(REGEXREPLACE(A3:A,"[-\s\d]+$","")))

Result:

enter image description here



Answered By - Tanaike
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing