+ Reply to Thread
Results 1 to 9 of 9

Reference Number

  1. #1
    Registered User
    Join Date
    02-08-2008
    Posts
    39

    Reference Number

    Hello again, it's been a while.

    I am currently creating a spreadsheet to record incoming files for my company. Each file must have a unique reference. Part of this reference will be made up of the file name and client name.

    At present I have the following formula:

    =LEFT(B4,1)&MID(B4,1,1)&LEFT(C4,1)&"_0001"

    Which produces something similar to BBG_0001

    Although this is a fairly unique reference already I need 0001 to be a unique number in its own right. This can be in any format provided it is a number and it has a minimum of 4 digits. It would be preferable for it to be in sequence but not essential.

    It should be noted that once these files have been dealt with the row containing the information (including reference) will be cut from that sheet and pasted into another sheet.

    Any help apriciated.

    Any questions please ask.

    Thank you
    Last edited by georgeeasten; 08-24-2010 at 12:32 PM.

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Reference Number

    try:

    =LEFT(B4,1)&MID(B4,1,1)&LEFT(C4,1)&"_"&text(rows($1:1),"0000")

    Although the first part doesn't make sense (I assume a fudged example rather than an 'issue'?)
    hth
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Reference Number

    Won't sorting distort the numbering?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    02-08-2008
    Posts
    39

    Re: Reference Number

    Sorting does distort the numbering. I will need to be able to sort the data with the auto filter.

    Each reference needs to be fixed to the entry not the row. Basically if row 3 has '0001' but is moved to become row 5 it should still show '0001' rather than '0003' which it will currently if moved. - if that makes sense??

    But this is essentially exactly what I need so if we can overcome the sorting/moving issue then perfect!
    Last edited by georgeeasten; 08-24-2010 at 09:33 AM.

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Reference Number

    You could just use that formula and copy & paste as values over the top.

    I can't think of a suitable alternative (VBA is over the top)

    But this is an ideas factory, so someone may yet come to your aid with something more elegant...

  6. #6
    Registered User
    Join Date
    02-08-2008
    Posts
    39

    Re: Reference Number

    Thanks again Charlie but I really would like to get something a little 'more elegant'!! ;-)

    Would anyone like to take up the challenge for something in VBA. Possibly something run from a button so I can select the cell or row containing that cell to populate it with the reference?!?!!?

    The formula I have which produces the reference from various selections of data from various cells within the given row is as follows:

    ="PJW/"&G3&"/"&LEFT(B3,2)&LEFT(C3,2)&TEXT(ROWS($1:1),"0000")

    It produces the following: PJW/GAFE/BiTh0001

    The first part will always be PJW the second is the initials of the person dealing with that work (taken from column G) and the rest is the first two letters of two relevant entries with the unique number at the end.

    A bit messy but it works!

    Thanks again Charlie (BTW I already give to Action Aid! ;-) )

  7. #7
    Registered User
    Join Date
    02-08-2008
    Posts
    39

    Re: Reference Number

    I have now solved the problem (I'm on a roll today!!!).

    I have two parts to creating the reference and this is the only way I can think of solving it. If someone else has any comments, I welcome them.

    I have this in the cell in which the reference is to be held and indeed each cell in column K

    ="PJW/"&G5&"/"&LEFT(B5,2)&LEFT(C5,2)&Data!$K$7

    I have this attached to a button marked 'create reference'

    Please Login or Register  to view this content.

    Because of the order everything happens a new random number is created each time and the random number is preserved once the copy and paste special is executed!

    What is produced is PJW/GAFE/AZGr15794

    PJW being the manager, GAFE the case handler, AZGr two letters from two relevant cells and then the random number.

    I have to say I'm quite pleased with this!

    Thank you to everyone that helped me and as I said any comments are welcome.

  8. #8
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Reference Number

    Range("K7") = Int((9999 - 0 + 1) * Rnd + 9999)
    Will create duplicates.

    Something more like this:

    Please Login or Register  to view this content.
    but it's impossible to test without a sample upload

  9. #9
    Registered User
    Join Date
    02-08-2008
    Posts
    39

    Re: Reference Number

    It works!

    I would attach a copy but it is now 2mb so it exceeds the upload limit.

    But thanks again Charlie.

    Muchos respect

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1