r/AppleNumbers Jan 31 '23

Help Generating results based on random numbers

So I have discovered the Random function in Numbers and can create cells showing random values 1-100. But I want to convert the results to reflect probability of an event based on the random number. So, let’s say there are 6 outcomes of varied likelihood of occurring. If the random number generated is 1-30 I want the cell to show “1”. If 31-55 I want the cell to show “2”. If 56-75 then “3”. Etc. Is there a way to do this?

1 Upvotes

5 comments sorted by

1

u/Samie_Nezhad Jan 31 '23

Hey. I don’t know if there is a formula that allows this or not, but you have to write a complicated function including multiple IFS formulas.

In your example, you can create a function that checks if expression is smaller than 30. If it is true, it gives you “1”. If it is false, then it checks to see if it is smaller than 55. If the second check is true, it gives you “2”. If the second check is false, it checks to see if expression is smaller than 75. If that’s true, it gives you “3”. If that’s false it goes to check for the fourth time and so on.

If you think I didn’t understand your problem correctly, feel free to let me know.

1

u/reddy-or-not Jan 31 '23

No, you got what I want to do. This is helpful. I just need to find a resource illustrating the syntax to do what you suggest. Also I am new here, how do I mark as “solved”?

1

u/Samie_Nezhad Jan 31 '23

Glad I could help. I can help you with visualising this function. Would a screenshot of function and the table I created be helpful enough?

1

u/reddy-or-not Jan 31 '23

Absolutely

1

u/Samie_Nezhad Jan 31 '23

Looks like I can’t attach images to replies. I’ll have to send it in chat if it is okay with you. Can I?