Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2009, 06:44 AM
bignick270 bignick270 is offline
Novice
creating unique numbers in excel
 
Join Date: Apr 2009
Posts: 1
bignick270 is on a distinguished road
Default creating unique numbers in excel

Is there a way in Excel using macros or array functions etc that would allow me to create a set of random numbers that would be unique.



The random numbers would not only have to be unique with the current set but also unique with sets from previous dates.

For instance you are creating 200 unique numbers per day. Today you wanted 200 unique numbers that was also unique with the previous 200 numbers you created yesterday.

The numbers would be in a range from 1000 to 65536. The system would also have to be easily expandable which would allow for easy number generation from day to day.
Reply With Quote
  #2  
Old 05-17-2009, 05:40 AM
kgfendi kgfendi is offline creating unique numbers in excel Windows Vista creating unique numbers in excel Office 2007
Novice
 
Join Date: May 2009
Posts: 7
kgfendi is on a distinguished road
Default

HI,

This is typical type for sorting 5 different numbers. You can change the code to be more than this number (exmaple 2000). Good luck for coding!!

Code:
Sub Sorting()
 
    Dim Used(10) As Boolean
    Dim TheRandom As Integer
    For i1 = 1 To 10
    Used(i1) = False
    Next i1
 
    For i = 1 To 5
        Do
        TheRandom = Int(Rnd(i) * 10)
        Loop Until Not Used(TheRandom)
        Used(TheRandom) = True
 
    ActiveCell.Offset(i, 0) = TheRandom
 
    Next i
End Sub
Please get back again if you could not match this solution to accord your numbers!

Kind Regards

Last edited by Bird_FAT; 05-17-2009 at 08:43 AM. Reason: added code brackets
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting numbers: Darren Word 0 04-01-2009 11:22 AM
creating unique numbers in excel Page numbers...starting on page 3 Motiv8td1 Word 2 02-21-2009 07:21 AM
creating unique numbers in excel Creating Hyperlinks alicein1derville Excel 5 02-08-2009 10:31 PM
Reversed Printing of Numbers in Numbered Documents HCM1962 Word 0 09-22-2008 10:39 AM
Creating a Distrubution List from Excel webphotogeek Outlook 0 01-10-2008 11:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft