Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default VLOOKUP post UDF (#DigitsFirstID) creates error

I'm creating a schedule in excel that requires some data processing
using three main catagories ProductName, ProductID, and ProductLot.
The ProductLot makes VLOOKUP tricky. Example: Product A has a lot
sequence that goes something like this 10000,10001,10002, 10003, 10004,
10005, A10000, A10001, A10002, A10003, A10004, A10005, B10000...etc,
Product B has a lot sequence 10006,10007,10008, 10009, 10010, A10006,
A10007, A10008, A10009, A10010, B10006...etc. And so on and so on.
What makes this tricky again is that Lots can be split multiple times
creating lot numbers such as A10008A and A10008B where A10008B can
further get slipt like this A10008B1 and A10008B2. So to get ride of
all the junk I don't need and just leave me that 5 digit lot sequence I
have use the below VBA function (not sure on the terminology). WORKS
GREAT! THANK YOU HARLAN! But then when I got to do a VLOOKUP on the
processed info, say A1 is the unproceded info A10008B1 and A2 is the
processed info 10008, in A3 I try to do a VLOOKUP(A2,DATATABLE,3) to
retreieve other important data about the product but I get an error
"#NA". I'm pretty new at excel but was wondering a way to get around
this? Or is there a differnet function that I could use to extract the
5 digit lot sequecne specific to that ProductName and ProductID?

Thanks

bactfarmer

Extract the first set of digits found in another cell.
Function DigitsFirstID(s As String) As String
'Harlan Grove, worksheet.functions, 2003-10-20
'extract first string of digits, based on
'--
http://google.com/groups?threadm=_RK...wsrang er.com
Dim i As Long, j As Long, n As Long
n = Len(s)
i = 1
Do While i <= n And Mid(s, i, 1) Like "[!0-9]"
i = i + 1
Loop
j = i + 1
Do While j <= n And Mid(s, j, 1) Like "[0-9]"
j = j + 1
Loop
DigitsFirstID = Mid(s, i, j - i)
End Function

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vlookup error with subtotal El Bee Excel Worksheet Functions 0 January 25th 06 06:00 PM
VLOOKUP Error with "TRUE" Andrew Excel Worksheet Functions 3 January 25th 06 01:16 AM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 05:28 PM
Vlookup #N/A error due to formatting Patrick_KC Excel Worksheet Functions 4 December 21st 04 07:39 PM
#N/A error with VLOOKUP Michelle Tucker Excel Discussion (Misc queries) 4 December 14th 04 01:23 PM


All times are GMT +1. The time now is 07:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"