Home > Software engineering >  Regular Expression - Extract Words and number
Regular Expression - Extract Words and number

Time:08-04

So I'm using Regexextract in GoogleSheet to find the value for a big amount of data. I have 2 problems I don't know to extract or what I did wrong. Feel free to point out my mistakes and help me with a solution. Require: I need to extract the part number which format is ABCD#### or ABCD-#### which is is Upper character and numbers follow after, with or w/o "-" , for example KTA1763 or SPD-4124 @ I use this formula: =Regexextract(A1,"([A-Z] -?[0-9]*)") .FYI, the values I'm extracting, it could appear either at the beginning, middle or last.

1.First problem, I have the value as below: REACH TECH 223/224 list document for KTD2026BEWE-TR => Extract result : REACH [What I need: KTD2026]

2.I have the value as: information for Part number KTA1550EDS-TR => Extract result: P [What I need: KTA1550]

Please let me know which part in the formula should I fix to have the final expected result. Or how should I alter my formula for that matter, big thanks

CodePudding user response:

go for:

=INDEX(IFNA(REGEXEXTRACT(A1:A, "[A-Z] \d ")))

enter image description here

CodePudding user response:

Try this in one cell.

=ArrayFormula(IF(A2:A="",,REGEXEXTRACT(REGEXEXTRACT(A2:A, ". "&REGEXEXTRACT(A2:A, "[0-9] ")), ". \s(. )")))

enter image description here

  • Related