Help

Re: Auto Generate Random(ish) Group Assignments

Solved
Jump to Solution
487 2
cancel
Showing results for 
Search instead for 
Did you mean: 
MD_2241
4 - Data Explorer
4 - Data Explorer

I'm trying to randomly assign one of four Group IDs (AlphaGroup, BetaGroup, GammaGroup, DeltaGroup) to all existing/new records in my database whether they're imported in bulk or added manually. I've been using this formula—however since some of my records will be imported in bulk, their created time remains the same and gives them all the same Group ID). I also have First Name, Last Name, Email, and other fields that could potentially be useful here. Any idea how to address this? Thanks!

 

 

IF(
    SECOND( CREATED_TIME() ) < 15,
    "AlphaGroup",
IF(
    SECOND( CREATED_TIME() ) < 30,
    "BetaGroup",
IF(
    SECOND( CREATED_TIME() ) < 45,
    "GammaGroup",
    "DeltaGroup"
)))

 

1 Solution

Accepted Solutions

Probably something like this:

IF(
  MOD(Autonumber - 1, 4) = 0, 1,
  IF(
    MOD(Autonumber - 2, 4) = 0, 2,
    IF(
      MOD(Autonumber - 3, 4) = 0, 3,
      4
    )
  )
)

See Solution in Thread

3 Replies 3

How about using an autonumber field and whether it's divisible instead?  Less random(ish) than your current solution, but would split evenly?

Thanks @TheTimeSavingCo. That sounds like a great solution. How would you write the code/formula assuming we create an autonumber field?

Probably something like this:

IF(
  MOD(Autonumber - 1, 4) = 0, 1,
  IF(
    MOD(Autonumber - 2, 4) = 0, 2,
    IF(
      MOD(Autonumber - 3, 4) = 0, 3,
      4
    )
  )
)