Check the first two digits in a String in a Macro VBA function

koteshi

New Member
Joined
Sep 6, 2011
Messages
6
Alright, imagine I have a worksheet which looks like this:

Item No.
916.96.426
210.11.001
284.00.921
372.01.921
558.12.943
634.23.211
634.65.407
634.69.500
660.07.221
660.07.301
903.99.631
100.87.802
124.41.112
210.11.003
210.40.601

but just with 8800 Item Numbers. The first two digits of the item number indicate which group the item belongs to.

1XX.XX.XXX = furniture handles
11X.XX.XXX = golden furniture handles
2XX.XX.XXX = architectural hardware

etc.

The column next to "Item No" is supposed to tell me what kind of group this article belongs to. You can imagine that if I try to use nested IF functions I run in into some trouble as Excel 2003 doesn't supports more than 7 nested functions...

Unfortunately I have no other option than to work with Excel 2003 in my company, so I was wondering if there is some way to solve this issue with some VBA code instead.

I was thinking about IF and ELSEIF functions but I don't know how to check the first two digits/characters of a string.

Does anyone have a clue how to solve that or any better/more elegant solution?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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