+ Reply to Thread
Results 1 to 7 of 7

auto generating number based on information from other cells

  1. #1
    Registered User
    Join Date
    02-06-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    14

    auto generating number based on information from other cells

    I would like to auto generate a reference number using the name entered, date, and page number from a guide.
    For example,
    John Smith
    2/21/2012
    pg. 158

    would come out to

    JS-02212012-158

    Is there any possible way to have this number auto generate when information is input?
    Last edited by cody1187; 02-21-2012 at 02:27 PM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: auto generating number based on information from other cells

    Is the name, date and page in 1 cell or separated to 3 cells?
    Quang PT

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: auto generating number based on information from other cells

    Say they are in A1:A3 try:

    =LEFT(A1,1)&MID(A1,FIND(" ",A1)+1,1)&"-"&TEXT(A2,"MMDDYYYY")&"-"&RIGHT(A3,LEN(A3)-FIND(" ",A3))

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Registered User
    Join Date
    02-06-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: auto generating number based on information from other cells

    I get an error "a value used in the formula is of the wrong data type"

    Name, date, and pg# are each different cells.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: auto generating number based on information from other cells

    Try this:
    Please Login or Register  to view this content.
    in which date issue is treated as Text with 8 digits

  6. #6
    Registered User
    Join Date
    02-06-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: auto generating number based on information from other cells

    Thanks All
    I messed up in my example the page # is in just a number "158" not "pg. 158"
    after i changed the formula it works perfectly

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: auto generating number based on information from other cells

    No worries.

    Dom

+ 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