• 0

I need help !


Question

Hi,

I have got a problem, I am working on a data base in my job and I have somthing like that : 04A2413 which is a batch number.

In fact 04 is the year A the Month (A january B febuary...) 24 the day and 13 the order.

My problem is that I would Have a function which put in a cell the according date with the batch number.

In my example the Batch number is 04A2413 and the cell has 24/01/2004 (French date).

I someone has an idea to help me ? :cry:

thanks in advance

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

What's the order bit? That doesn't make sense to me. The rest of it is fairly straightforward.

If you just want to use a formula in a cell, use something like:

=DATE(INT(LEFT(A1,2))+2000,CODE(MID(A1,3,1))-64,INT(MID(A1,4,2)))

Or if you want to use a macro, include the following function:

Public Function GetDate(ByVal Value As String) As Date
    GetDate = Mid(Value, 4, 2) & "/" & CStr(Asc(Mid(Value, 3, 1)) - 64) & "/" & CStr(2000 + CInt(Left(Value, 2)))
End Function

And then call it from your code, e.g.

Dim x As Date
x = GetDate("04A2413")

As I said above, I don't know what you mean by the order, so you'll have to do that yourself...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.