Reputation: 37
I have a problem, I'm receiving massive data in shape
BA-01-01 BA-01-02 BA-02-01 WPS-01-01 WP-01-01 DA-01 DA-02
Where first 2-4 Letters are a Tag of product (BA), after, if product has different types we have number of type (01,02), and in the end if i have multiple location of product number of location (01,02,03).
And I need to calculate total amount of product with same Type. It can happen as you can see from screenshot below that some product dont have type, only tag So I need to remove from each product Id everything that goes after last "-"
Upvotes: 2
Views: 696
Reputation: 1
arrayformula mode:
=ARRAYFORMULA(IFERROR(REGEXREPLACE(A1:A, "-[^-]+$", )))
Upvotes: 0
Reputation: 521249
We can try using REGEXREPLACE
as follows:
=REGEXREPLACE(A1, "-[^-]+$", "")
The regex pattern -[^-]+$
will match the last -digit
term and then replace with empty string, to effectively remove it.
Upvotes: 1