In Excel I have a number of columns containing characters of different types such as:

```
WS-S5-S-L1-C31-F-U5-S9-P14
WS-S5-S-L1-C31-F-U5-S8-P1
WS-S5-N-L1-C29-V-U16-S6-P6
```

I want to convert these to 8 characters using the following rules:

- keep only the last three segments
- remove the U and add prefix 0 where appropriate
- remove S and add prefix 0 where appropriate
- remove P and add prefix 0 where appropriate

For example:

`WS-S5-S-L1-C31-F-U5-S9-P14`

convert to`05-09-14`

`WS-S5-S-L1-C31-F-U5-S8-P1`

convert to`05-08-01`

`WS-S5-N-L1-C29-V-U16-S6-P6`

convert to`16-06-06`

I believe there is a way to use `IF`

, `FIND`

& `MID`

function to convert these in Excel but don't know how to start. Any help will be much appreciated.

## Update

Just finally, I wanted to convert this into 13 characters if possible for example:

- WS-S5-S-L1-C31-F-U5-S9-P14 convert to S1-F-05-09-14
- WS-S5-N-L2-C31-D-U5-S8-P1 convert to N2-D-05-08-01
- WS-S5-N-L1-C29-V-U16-S6-P6 conver to N1-V-16-06-06