Help with formula

twiley23

New Member
Joined
Oct 15, 2007
Messages
40
I was looking to see how to assign a word to certain numbers and make them random. Also the word would need to have an assigned # of
How many times it will show up.

For example:

# Friday Saturday Sunday

1
2
3
4
5
6
7
8
9
10
11

The word bacon will only show up 1 time on either the number 2 or 10 and be placed under Friday, Saturday or Sunday randomly

The word eggs will show up 2 times on either number 1 or 11 and be placed under Friday or Saturday or Sunday randomly

Thanks , please let me know if this is even possible.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hi,

What Excel version are you using?

It would be probably a bit easier to generate in Excel 365. But having only limited rows allowed, different for each word would make life harder.

In real problem - how many rows, how many columns, and how many different values (and with what count) is expected? May be the solution could be found with Solver?
 
Upvote 0
Hi,

What Excel version are you using?

It would be probably a bit easier to generate in Excel 365. But having only limited rows allowed, different for each word would make life harder.

In real problem - how many rows, how many columns, and how many different values (and with what count) is expected? May be the solution could be found with Solver?
My excel program is from 2013.

I have 11 rows and 3 columns.

There are a total of 11 words. Only 2 are duplicates. I can take a picture of what it will look like in the end result I’m going for. Thanks
 
Upvote 0
My excel program is from 2013.
Please update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
@twiley23 It will help the cause if you can clarify define / illustrate all the rules which apply.
Questions:
Is it essentially, having observed any row restrictions, one word randomly attributed to each row, in a random pick of the 3 columns?
9 discreet words of which 2 are duplicated to make 11 ?
Two of those words are restricted in respect of rows, as per your original post?
Does 'Eggs' appear once in row 1 and once in row 11 or could it be twice in one row and not in the other?
Are there any other words that have restrictions?
 
Upvote 0
Based upon what I think I understand so far the vba code below will refresh and fix random values in the yellow cells.
Formulas in B2:E12 then pick the words from F

VBA Code:
Sub RandPicks()

Application.ScreenUpdating = False
Range("G2:G9").Formula = "=RAND()"
Range("H10").Formula = "=CHOOSE(RANDBETWEEN(1,2),2,10)"
Range("I2:I12").Formula = "=RANDBETWEEN(1,3)"
Range("H2:H9").Formula = "=RANK(G2,G$2:G$10)+1"

Range("G2:I12").Value = Range("G2:I12").Value
Application.ScreenUpdating = True

End Sub



TestTime.xlsm
ABCDEFGHI
1#FridaySaturdaySundayWordsRandom#Random RowRandom Column
21  EggsWordA0.4754914253
32Bacon  WordB0.1791924982
43WordF  WordC0.0785291491
54  WordEWordD0.2586000673
65 WordA WordE0.4986718942
76OtherDup  WordF0.5539628131
87WordD  OtherDup0.8092007221
98  WordBOtherDup0.2927140863
109WordC  Bacon21
1110OtherDup  Eggs2
1211 Eggs Eggs2
RandPicks
Cell Formulas
RangeFormula
B2:D2B2=IF($I2=COLUMNS($B:B),$F11,"")
B3:D3B3=IF($I10<>COLUMNS($B:B),"",IF($H10=2,$F10,INDEX($F$2:$F$9,MATCH(2,$H$2:$H$9,0))))
B4:D10B4=IF($I4<>COLUMNS($B:B),"",INDEX($F$2:$F$9,MATCH($A4,$H$2:$H$9,0)))
B11:D11B11=IF($I10<>COLUMNS($B:B),"",IF($H10=10,$F10,INDEX($F$2:$F$9,MATCH(2,$H$2:$H$9,0))))
B12:D12B12=IF($I12=COLUMNS($B:B),$F12,"")
 
Upvote 0
Solution
I think that solution shall also allow only specific rows for given words. Going back to post #1:
word bacon will only show up 1 time on either the number 2 or 10 ....
word eggs will show up 2 times on either number 1 or 11 (so I assume eggs could not appear in row 2, or any other between 3 and 10).
 
Upvote 0
I think that solution shall also allow only specific rows for given words. Going back to post #1:
word bacon will only show up 1 time on either the number 2 or 10 ....
word eggs will show up 2 times on either number 1 or 11 (so I assume eggs could not appear in row 2, or any other between 3 and 10).
@Kaper Yes. the column of each row is random.
Words 10 and 11 (Eggs) will be in both rows 1 and 11
Word 9 (Bacon) will randomly be in either row 2 or row 10.
Depending upon which row contains Bacon, all other words will be randomly assigned to either rows 2:9 or 3:10
 
Last edited:
Upvote 0
@Kaper Yes. the column of each row is random.
Words 10 and 11 (Eggs) will be in both rows 1 and 11
Word 9 (Bacon) will randomly be in either row 2 or row 10.
Depending upon which row contains Bacon, all other words will be randomly assigned to either rows 2:9 or 3:10
Hey! Thank you so much ! this is what I was looking for. The only issue I'm running into is for the "Bacon" when it assigns to row 3 or 11 it shows N/a on the opposite row. How do I also have it choose between the 2 rows. Thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top