+ Reply to Thread
Results 1 to 10 of 10

Auto generate number???

  1. #1
    Registered User
    Join Date
    08-03-2004
    Posts
    10

    Auto generate number???

    I have a few questions regarding a workbook I am working on.

    Cell A1 Date
    Cell B1 Clause number (generated via vlookup)
    Cell C1 Activity number
    Cell D1 Description
    Cell E1 Voucher Type
    Cell F1 Voucher Number
    Cell G1 Expense

    Is it possible to have Cell F1 generate a number based on Activity number beginning with the number 1 and when another entry occurs with the same activity number occurs on a different date it places the same number generated in a cell beside it? when another activity occurs it needs to add 1 to the previous voucher number.

    I can have several expenses for an activity occur throughout a month but only need to create one voucher per activity at months end. This is done via a pivot table which I have already created.

    This has stumped me.

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Excel can undoubtedly do it, but You have to figure out your own formula.
    Best regards,

    Ray

  3. #3
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    There are many possibilities ...
    Jim is explaining two of them ...
    http://www.mcgimpsey.com/excel/udfs/sequentialnums.html
    HTH
    Carim


    Top Excel Links

  4. #4
    Registered User
    Join Date
    08-03-2004
    Posts
    10
    Hi Carim,

    I had a look at that site, thanks for the link. However I may have not explained what I want to do correctly.

    I have attached a sample sheet that I made up.
    Attached Files Attached Files

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try

    =IF(MAX(C$1:$C1)<MATCH(B2,$B$2:B2,0),MAX($C$1:C1)+1,MATCH(B2,$B$2:B2,0))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Registered User
    Join Date
    08-03-2004
    Posts
    10
    Hi VBA Noob,

    Thanks for the formula. Now I need to go try to understand how it works....

    I will let you know if I can make it work in my workbook.

    Thanks again.

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem.

    This might help

    http://www.contextures.com/xlFunctions03.html#Match

    The below finds the first match of a number. When you drag down B2 changes to B3 etc but returns the row of the match
    MATCH(B2,$B$2:B2,0)
    The if statement checks to see if the row number is greater than the Max in cells above

    MAX(C$1:$C1)<MATCH(B2,$B$2:B2,0)
    If true is returns the max from the cells above the current cell and adds 1

    MAX($C$1:C1)+ 1
    if false it returns the row number

    MATCH(B2,$B$2:B2,0)
    HTH

    VBA Noob

  8. #8
    Registered User
    Join Date
    08-03-2004
    Posts
    10
    I tried this one out and unfortunately it doesn't work when I try this with longer lists. Thanks for the effort nonetheless.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Can you post the list

    VBA Noob

  10. #10
    Registered User
    Join Date
    08-03-2004
    Posts
    10
    Sure, it is attached.

    I think I have found a solution to this. I am still going through some tests to make sure it will work in all situations.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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