Extracting certain data from cells

jjacks60

New Member
Joined
Jul 28, 2014
Messages
40
Hi,

I have a list of SKU numbers that changes constantly, but I always want to extract a certain part of these references.

1. IF there is a -, then extract whatever the length of the cell is
2. Next IF, IF length = 5, then extract the cell I.E. E41
3. Next IF, if length > 5 then find a string of 5 numbers from the cell and extract those numbers only

I currently have it working for the first two IFs, having trouble making the last happen. The issue is sometimes a SKU looks like this "P70403PAK1", sometimes like this "70320CDN5". In either of these scenarios I want the sequence of 5 numbers extracted to use as a reference in a vlookup I've made.

Here is the formula as it stands now.
=IFERROR(VLOOKUP(IF(LEN(E47)=5,LEFT(E47,5),IF(FIND("-",E47),(LEFT(E47,LEN(E47)))*****)),'Case #''s'!A:C,3,0),"No SKU Ref!")

Where the ***** is is where I'd make the last IF function.
It may require two additional IF functions.

The problem is every cell I'm reference is currently text because of ' being in front of every SKU value. This is the way the raw data comes to me I can't alter it.

Any advice is appreciated greatly.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top