+ Reply to Thread
Results 1 to 11 of 11

Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Time

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    69

    Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Time

    Update 1:

    This is part in search of a practical solution and more in part exploration.

    Let me phrase the question another way: If you were to look at an item, and be told to give it a number, and to be sure that number was not used previously, with previously not necessarily meaning never, but not used in the last 1,000 to 2,000 occurrences, and to not look at any list to be sure the number wasn't used previously, other than date and time, what would you do? If there are literally one or two duplicates, that would be fine.

    Update 2:

    Assuming that in most cases the person has access to either the internet or Excel, I suppose I can always use a random number generator. I think I can do a number between 1 and 9,999, as I wouldn't want more than 4 digits. What I am curious about but am not sure how to calculate are the following: 1) Assuming I want only 1,000 numbers, what's the probability of me getting a duplicate number? 2) Assuming I want only 2,000 numbers, what's the probability of me getting a duplicate number?

    ORIGINAL POST:

    I'm labeling some items by numbers, and would like to quickly assign an identifier / numbers to those things, without having to always check a list to see if the number was already used previously.

    One way of course to do so is to simply label those items with the current date and time, as there would never be a duplicate. I however don't want to do so, plus the labeling / hand writing takes too long, especially when I am labeling the items on multiple sides.

    Idea 1:
    One idea I have, but don't have the time to test it out in Excel is to add the numbers up for the current date and time. So, for example, for 11/22/19 and 7:41 a.m. I would do 11+22+19+7+41 and if it were p.m., I would simply use the 24 hour format, so 19, instead of 7.

    1. However, will this method result in duplicates? If yes, when -- within hours, days, months, or years?

    2. I don't fully like this method as it will take some time to constantly be adding up the numbers.

    Idea 2:
    What about adding up the left digit of the minutes to the hour and then writing the seconds? So, 7:47 25 seconds = 1125
    How long before duplicates result though? Keep in mind this won't be occurring second by second and there may be anywhere from 30 seconds to perhaps 10 minutes before another label is assigned.

    Other Ways?
    What other ways are there to pick random, unique numbers?

    Here is some additional info:

    1. The numbers don't have to be in order. So, 1311, 999, 2005, 275, etc. is fine.

    2. As for the limit / max, I suppose 1,000 numbers / identifiers should be more than good enough, but if not, definitely 2,000.

    I look forward to the responses.

    Thanks.
    Last edited by roseuz; 11-22-2019 at 11:18 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,628

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    concepts with adding digits or numbers being part of date time will generate duplicates very soon. for instance for your first case 1/22/19 and 7:41 a.m. I would do 11+22+19+7+41 first duplicate will appear in 59 minutes at 1/22/19 and 8:40 a.m. 11+22+19+8+40 = 100 too


    As for the time and date: if you dont ming having date and time separators (depending on setup of your system it could be / . - for date and almost always : for time) you can press two shortcuts for writing date and time:
    < Ctrl >+< ; > and < Crtl >+< : >
    (control with semicolon then control with colon
    and what you will get in the cell would look like (for instance)
    2019-11-2214:41

    next idea < Ctrl >+< ; > space < Crtl >+< : >
    you get regular date and time. Now change format of the cell to General and you will see unique number like
    43791,6145833333

    LAst one - a macro assigned to a shortcut which will look for a maximum value (lets say in a column with active cell and write in this cell value which is bigger by 1 than current maximum
    Last edited by Kaper; 11-22-2019 at 09:52 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Thanks Kaper. This is loosely related to Excel, but Excel can be used to quickly test theories.

    I know of the shortcuts for date and time. My issue is with labeling the boxes (that's what I am labeling). I want to label 5 sides and don't want to write the date and times 5 times, plus I prefer to not memorialize the dates).

    As I write the numbers in Excel, I will not necessarily be typing them in one after another. They will be in different rows and perhaps even in different sheets. I don't want to scroll or look through the sheet(s) before assigning another number.

    This is why I am looking for some quick, unique identifier. I have had this thought for a long time and am curious to solutions, if there are any.

  4. #4
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Two different methods to assign a unique PO number.
    Attached Files Attached Files
    Uploading an attachment will assist Forum Members in finding the correct Solution for you. Create a dummy worksheet if necessary, add your start data and show where / what your expected results should be. TO ADD A FILE:

    Go to 'Advanced. click on 'Manage Attachments. Select 'Browse & Choose your file, Select 'Upload and then close the Attachment window.

  5. #5
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Quote Originally Posted by BlindAlley View Post
    Two different methods to assign a unique PO number.
    BlindAlley: Thanks and can you please elaborate more on this.

    Where do the numbers 2250, 2252, etc. come from. 2251 for some reason is not there in either table.

    1st Table: Just pick a starting number and that's it?

    If yes, I can do this with any number, as it just seems to be adding one to the previous number. I prefer to not have to look at a list, but rather generate a random, unique number on the spot.

    2nd Table:

    No matter the date or year, the starting number seems to be 1,000.

  6. #6
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    The numbers 2250 etc are just a test, you didn't supply a template. The missing number tested the IF Blank cell part.

    You can put the start number in any cell and use any starting number you like, just update the formulas to reflect the new start cell, and yes it adds 1 to the last number used.

    Ignore the 2nd example, that was made for someone that required an annual start number in different yearly tabs.
    Last edited by BlindAlley; 11-22-2019 at 10:57 AM.

  7. #7
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    O.K. Please see the top of the original post, as I updated it with some additional info.

    Thanks.

  8. #8
    Valued Forum Contributor
    Join Date
    04-26-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    502

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Update 1: I've given you the practical solution. If you want a magic formula you could post the question in the VBA forum.

    Update 2: Excel Randbetween {1 and 9,999} is a volatile formula that generates unknown amounts of duplicates and changes numbers every single time you change an entry in your spreadsheet, which will require copy and pasting the assigned values over top of the formulas negating using a formula in the first place.

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,628

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Random number generator in range 1-9999 wil be probably by far unnaceptable for you.

    Already between 1000 randomly generated values from 4digits range you can expect usually typically between 40 and 50 duplicates per case and between 1 and 2 "triplicates".

    Not trying to calculate it from probability formulas, I did in excel 1000 test generating 1000 numbers from this range.
    The lowest number of duplicates (not counting higher repetitions - the highest ever met in the 1000 tests I did was "pentaplicate") received was 27 the highest 65.

    So definetely no.

    As for ideas for time:
    0 = seconds between 0 and 14
    15 =seconds between 15 and 29
    30 =seconds between 30 and 44
    45 =seconds between 30 and 44
    + month (1-12)
    these are 2 digits
    then day 1-31
    hour 24h format
    and probably one digit for year
    you have 7 digits unique number for any moment not closer to other than 15 seconds
    What's more - not clearly connected with date for third party, and rather easy to code. the only calculation is adding month to seconds rounded down to nearest 15.

  10. #10
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    69

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    Much thanks Kaper for the response.

    1. For this line: "45 =seconds between 30 and 44", you meant to say "45 =seconds between 45 and 59".

    2. Either there is something I am not understanding or the logic is flawed, as I am immediately getting duplicates since the minutes are not being factored in.

    For example:

    11/22/19 3:42:45 pm = Part 1: 45+11 = Part 2: 56 22 15 9
    11/22/19 3:48:45 pm = Part 1: 45+11 = Part 2: 56 22 15 9

  11. #11
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,628

    Re: Coming up with a Unique Number / Identifier Every Time: Besides Actual Full Date & Tim

    1) of course seconds 45-59 - 45
    2) Missed minutes digits 8&9.
    But on the other hand - not in terms of number, but in terms of time: when duplicates would be not a problem - after a year? May be you don't need a year information? It's not that the numbers will be repeated, but that some could repeat.
    If you have a calendar handy with "day in a year" number day+ month will be 3 digits 1-365/6 and you could add 500 for PM hours. Then seconds + hours same way I proposed originaly for seconds and month then minutes so in total 7 digits

    May be the best way is to have simple mechanical clicker counter. Before each package you click it. The number advances by one, and you use it. No waiting for excel to start, no calculations, power failure proof ...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 03-24-2019, 11:57 AM
  2. [SOLVED] time sheet help, format TIME and formula based on the actual time entered.
    By bh mng in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-06-2016, 01:10 PM
  3. [SOLVED] Converting an elapsed time in decimal number format to an actual time :S
    By Spicey_888 in forum Excel General
    Replies: 3
    Last Post: 07-20-2014, 08:53 PM
  4. IF contain # in a text extract the full number coming after it
    By nanda123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-13-2013, 06:49 AM
  5. Actual Hold Time and Actual Talk Time
    By MaunishP in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2013, 08:15 AM
  6. actual time and date
    By kizzie in forum Excel General
    Replies: 4
    Last Post: 08-10-2005, 05:43 AM
  7. [SOLVED] Creating a unique ID number based on date and time
    By WillRn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-03-2005, 09:06 PM

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