Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:50:00+00:00 2026-06-08T03:50:00+00:00

I need to translate an old program working on AS/400 that was picking random

  • 0

I need to translate an old program working on AS/400 that was picking random students to work for my city. I can use any program, as long as it works. To make it simple and fast, i chose excel.

However, i come over a small problem. I need to have no duplicates, because the same student can’t do 2 jobs over one summer. Also, i need this to be flexible, since every year, new students will be added and some will be deleted.

This function works almost as much as i would want it:
=INDEX($A:$A,RANDBETWEEN(1,COUNTA($A:$A)),1)

The index $A:$A gets all the lines in the column A. So even if i add 20 names, it will take them into consideration. Then it choose randomly a value (the name) between the line 1 and the number of total lines (COUNTA) in the column $A. The problem with this method is that it allows duplicates.

Another function i found was to create a colum full of =ALEA() and then rank these by the numbers. This is not very pretty, but at least, there is no duplicates. The problem comes from my formula, that is static, and that i can’t make flexible:

=INDEX($A$2:$A$74,RANK(B2,$B$2:$B$74))

My names are in the colum $A and my random values in colum $B. What i say is, rank the value in B2 (then B3, then B4, etc.) that is found in the column B.

What i would like is to integrate the COUNTA into the second function and (IF POSSIBLE) take the RANDBETWEEN instead of the rank function so that i don’t have ugly numbers.

I am opened to use the first function with some kind of duplicate check. As long as the secretary doesn’t have to do a lot of manipulation, it should be fine.

Thanks a lot for your help xox

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:50:04+00:00Added an answer on June 8, 2026 at 3:50 am

    I’ve created something in VBA that does what I think you want. Now keep in mind I’m very new with VBA, so it probably isn’t the prettiest thing. To be clear, I had 10 names in column A from rows 1 to 10 and then simply ran this subroutine and it generated a list of unique names in column F. Here’s my code:

    Sub getRandom()
        Do While Application.WorksheetFunction.CountA(Range("A:A")) > 0
            Dim count As Integer
            count = Application.WorksheetFunction.CountA(Range("A:A"))
            Dim name As String
            name = Application.WorksheetFunction.Index(Range("A:A"), Application.WorksheetFunction.RandBetween(1, count))
            Dim row As Integer
            row = Application.WorksheetFunction.Match(name, Range("A:A"), 0)
            Range("F11").Select
            Selection = name
            Rows(row).EntireRow.Delete
        Loop
    End Sub
    

    If you wanted to get the names one at a time, just remove the loop. How it works is it does exactly what you did with the INDEX and RANDBETWEEN functions, grabs the name in column A with that generated number, then deletes that row entirely, and thus no unique name is generated.

    I chose column F arbitrarily and cell F11 specifically since that cell will not be affected when the rows are deleted.

    I hope this helps, and if it’s not what you were looking for I’ll see if I can enhance it a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to translate messages and i can't find a file that contained them?
I need your help to translate a query into pyes. This query is working
I have these WHERE conditions in a PostgreSQL query that I need to translate
Im a coding a library including textual feedback that I need to translate. I
i need to translate my site in multiple languages. i was thinking to use
I am getting an XML file that I need to translate into another standard
I need to translate what is commented within the method, to assembler. I have
I need to translate the a carbon method into cocoa into and I am
We need to translate some of our UI to English, and the question arises:
I have this link which i need to translate in a php variable. http://www.facebook.com/dialog/apprequests?app_id=346824075388300&to=1149862205&message=Facebook+Dialogs+are+so+easy%21&redirect_uri=http%3A%2F%2Fpenelope-ns.net%2Ffb%2F

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.