# Extract first three chatacters

#### SimonHughes

##### Active Member
Hello, I need to extract the first three characters from a string where the characters are one of the following: UV2, UV3, UV4, UV5. The characters are always to the left of the column. I could probably use a LEFT, IF/OR formula but would appreciate any help.

I am using Excel 2010 on Win 7

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi.

Something like this?
Excel Workbook
AB
1UV10000UV1
2UV2ABCDUV2
3UV3AB33UV3
Sheet

My apologies, I simplified the task by not stating that I have a wide variety of part numbers starting with characters other than UV2 etc. Could be IF2 or PM6 etc and I just want to extract the UV2 and so on.

My apologies, I simplified the task by not stating that I have a wide variety of part numbers starting with characters other than UV2 etc. Could be IF2 or PM6 etc and I just want to extract the UV2 and so on.

Try something like...

=IF(OR(LEFT(A2,3)={"UV1","UV2","UV3","UV4","UV5"}),LEFT(A2,3),"")

I'm a little unclear as to what you are actually after. Does this give you what you want?

=IF(LEFT(A1,2)="UV",IF(OR(--MID(A1,3,1)={2,3,4,5}),LEFT(A1,3),""),"")

EDIT NOTE: Use Aladin's formula... it will be more efficient than the one I posted.

Last edited:
Many thanks to the three of you - much appreciated

The formulas from Aladin and Rick both work perfectly. Very happy!

Excel Workbook
AB
1UV10000UV1
2ABCDEF
3UV3AB33UV3
Sheet

Many thanks to the three of you - much appreciated

The formulas from Aladin and Rick both work perfectly. Very happy!

Sorry, have not seen it.

Hi Screwdriver, this works as well - but I cannot understand the logic. I see that COUNTIF(E125,"*UV*" does = 1 and therefore it returns what we want but how does COUNTIF(E125,"*UV*" = 1?

Hi.

It's another method.
See the red "2"
Excel Workbook
AB
1UV10000
2ABCDEFABC
3UV3AB33
Sheet

Replies
7
Views
296
Replies
6
Views
85
Replies
19
Views
487
Replies
7
Views
330
Replies
7
Views
111

1,203,462
Messages
6,055,563
Members
444,799
Latest member
CraigCrowhurst

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back