Created
February 8, 2022 08:28
-
-
Save palikhov/e76fc6f7e04f012eb5046f7ecac7bde8 to your computer and use it in GitHub Desktop.
Return random value from list stored in one cell in Excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function RandomValueFromCell(r As Range, separator As String) | |
| Dim cell As Range | |
| Dim i As Integer | |
| Dim x As Double | |
| Dim ArraySize As Integer | |
| List = Split(r, separator) | |
| ArraySize = UBound(List) + 1 | |
| RandomValueFromCell = List(WorksheetFunction.RandBetween(1, ArraySize) - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment