Automate Calculation Through Macro Do Loop

rwmill9716

Active Member
Joined
May 20, 2006
Messages
495
Office Version
  1. 2013
Platform
  1. Windows
I am trying to calculate the number of times a 3-letter sequence (Ric or Cir) will occur randomly in s 1,000 randomizations of their single letters. Column A has a 3-letter sequence in Cells A2,A3, & A4; Column B has random numbers on which Column A will be sorted; Column C puts 3 consecutive Cells together to form a 3-letter word; Column D that word's inverse; Column E generated a 1 if either the word or its inverse matches the target words in Cells F1 and G1. Cell F2 (Sum E2:E1001) equals 1 if there's a match and 0 if not.

What I need is a macro that will perform this 1,000 times and keep a count of the number of times F2 equalled a 1. That is, I'm trying to find out how many times a 3-letter name could be expected to be found in a 1,000 random distributions. Note, I show blanc cells here for those not involved in the name, but I will add more letters in these blanc cells, i.e., there will be more Rs, Is, & Cs.
 

Attachments

  • Bible Code.jpg
    Bible Code.jpg
    30.4 KB · Views: 14

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I'm puzzled.
You have 3 letters only with which you will deal. Yes?
How is the rand() supposed to sort those letters?
What is the purpose of two letters and one letter in your table if you are only wanting to deal with 3 letters?
And what exactly do you mean by:
Note, I show blanc cells here for those not involved in the name, but I will add more letters in these blanc cells, i.e., there will be more Rs, Is, & Cs.
 
Upvote 0
Sorry, Brian. Attached is an example that's clearer. Col A contains 104 Cells (4 sets of 26 letters in the alphabet). Col B uses RAND() to generate random numbers; all Cols are sorted by Col B so the letters in Col A are randomized. Col C builds 3-letter words and Col D their inverse. Col E then marks (1) whether either of these words matches the words in F1 and G1. Cell F2 sums Col E to indicate where any of the words matched (here 0 did). My purpose is to evaluate how likely words (here RIC and CIR) would show up in a random sequence of letters. As it stands, I can hit key F9 and regenerate a trial, but I want to do that 1,000 times so a macro would be much more efficient. Ideally, I would hit a button; the macro would run its 1,000 simulations and then give me a result that tells me how many times in these 1,000 runs the match was made. For example, 990 of the runs may find no match, 9 of the runs 1 match, and 1 run 2 matches so the run result would be 11.
 

Attachments

  • 230827 Bible Code.jpg
    230827 Bible Code.jpg
    101.2 KB · Views: 14
Upvote 0
I have the general idea of what you are about, but could you upload a copy of your sheet so I can get a full understanding of how things are to work?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
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