Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
How to get only the last string from cells in one column

I'm trying to get the last String (from the right hand side) of the cells in a column but I cant figure it out.

I have this code that would get the first three digits from the left hand side but yeah that wont work.

var first_3_digs = values.filter(r => {
                                                                                    if(r.toString().includes('_')){return r;}
                                                                                }).map(r=> r.toString().split('_')[0]);

enter image description here

For example if I want as an input CS_1*44u i want the output u. Same for ml, l etc...

If you need more info please let me know.

Thank you so much for the help.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Example how to get the 'units' from several cells:

const unit = x => /[\d]+[\D]+/.test(x) ? x.match(/[A-z]+$/)[0] : '';

var texts = ['CS_1*44u', 'Case', '72x64ml', '11x37kg', '123'];

texts.forEach(x => console.log(unit(x))); // --> 'u', '', 'ml', 'kg', ''

Example how to get the 'unit' from one cell:

const unit = x => /[\d]+[\D]+/.test(x) ? x.match(/[A-z]+$/)[0] : '';

var cell_value = 'CS_1*44u';

console.log(unit(cell_value)); // --> 'u'

If you need to get the array of the 'units' from another array of cells you can map the function this way:

const unit = x => /[\d]+[\D]+/.test(x) ? x.match(/[A-z]+$/)[0] : '';

var cells = ['CS_1*44u', 'Case', '72x64ml', '11x37kg', '123'];

var units = cells.map(x => unit(x)); // <---- here

console.log(units); // --> ['u', '', 'ml', 'kg', '']

about 4 years ago · Juan Pablo Isaza Denunciar

0

as you have tagged formulas for possible solution, i will offer the following REGEXEXTRACT formula:

=REGEXEXTRACT(K1,"[^(\d+(\.\d+)?)(?!.*\d+(\.\d+)?)]*$")

explanation:

AFTER last occurrence of "a":

[^a]*$

LAST digit (with or without decimal):

(\d+(\.\d+)?)(?!.*\d+(\.\d+)?)

enter image description here

[EDIT]

where \d means a number, here is a (shorter) alternative which is also tested as working with the same dataset:

=REGEXEXTRACT(K1,"[^\d]*$")
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda