Excel problem

I want to generate random numbers in order to do a simulation.For example, let's say we have 20 cats 80 dogs. How can i have different combinations of those numbers? The function "rand" can generate 0-1 for x times.But I do not know how to generate only 20 "0" and only 80 "1"

 

key here is that you want to preserve the probability ratio of selection. if you create a variable that returns 0 or 1 equally, then it simulates a population where you have 50 cats and 50 dogs. rand will give you what you need, you just have to deal with the output accordingly.

to get a random integer from 1 to 10, use =ROUND(RAND()*9,0)+1

then assign your outputs accordingly 1-8 = dogs, 9-10 = cats

=IF(ROUND(RAND()*9,0)+1

-- sm
 
Best Response

Better yet - to actually get results 100% of the time, pick 100 random numbers (in Column A), then in column B find the rank of each number in Column A (rank amongst all the numbers in Column A). Then in Column C, if the value in Column B is Excel, so either write one in VBA or synthetically replicate. Replicating is a bit tricky, though possible. Will require 200 columns of calculations - basically in each subsequent column, find the max of the previous column, and then eliminate that number from the set, and move the set over to the next column. Then use match function to determine at which point a number dropped out, and divide by 2. Done.

 

ah, missed the combination bit. agree with dr joe that rand and rank would be the easiest solution.

put 20 cats and 80 dogs in cells A1:A100

put =RAND() in cells B1:B100

insert VBA module

run this subroutine

Sub rand_n_rank() Range("B1:B100").Calculate Range("A1:B100").Sort Range("B1"), xlAscending End Sub

-- sm
 

Voluptas quibusdam expedita facilis ipsa temporibus et distinctio quam. Corrupti dolorem autem voluptas provident repudiandae sit blanditiis. Molestiae autem fuga tenetur eos. Ut officia eius voluptates consequatur nesciunt doloremque ex quidem. Rerum excepturi et sed.

Molestiae ab placeat adipisci harum blanditiis fugiat eligendi. Unde veritatis et vel quibusdam fugiat officiis aut. Exercitationem aut iusto alias dolore. Sit dolorem harum architecto. Eius autem accusantium facilis eos minus est eveniet.

Impedit dolor officiis eum ut minima laudantium enim occaecati. Repudiandae excepturi aliquam voluptatem nihil quod voluptas. Et earum reiciendis neque. Consequuntur recusandae labore temporibus aliquid sint qui omnis quod.

Praesentium animi aut qui corrupti a odio minus. Sint quia id ipsum. Est provident non rem accusantium. Dolores quos sed illo labore possimus dolore aut optio. Ut quas omnis sunt sunt vel.

Career Advancement Opportunities

April 2024 Investment Banking

  • Jefferies & Company 02 99.4%
  • Goldman Sachs 19 98.8%
  • Harris Williams & Co. New 98.3%
  • Lazard Freres 02 97.7%
  • JPMorgan Chase 03 97.1%

Overall Employee Satisfaction

April 2024 Investment Banking

  • Harris Williams & Co. 18 99.4%
  • JPMorgan Chase 10 98.8%
  • Lazard Freres 05 98.3%
  • Morgan Stanley 07 97.7%
  • William Blair 03 97.1%

Professional Growth Opportunities

April 2024 Investment Banking

  • Lazard Freres 01 99.4%
  • Jefferies & Company 02 98.8%
  • Goldman Sachs 17 98.3%
  • Moelis & Company 07 97.7%
  • JPMorgan Chase 05 97.1%

Total Avg Compensation

April 2024 Investment Banking

  • Director/MD (5) $648
  • Vice President (19) $385
  • Associates (87) $260
  • 3rd+ Year Analyst (14) $181
  • Intern/Summer Associate (33) $170
  • 2nd Year Analyst (66) $168
  • 1st Year Analyst (205) $159
  • Intern/Summer Analyst (146) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
Secyh62's picture
Secyh62
99.0
3
Betsy Massar's picture
Betsy Massar
99.0
4
BankonBanking's picture
BankonBanking
99.0
5
kanon's picture
kanon
98.9
6
CompBanker's picture
CompBanker
98.9
7
dosk17's picture
dosk17
98.9
8
GameTheory's picture
GameTheory
98.9
9
Jamoldo's picture
Jamoldo
98.8
10
bolo up's picture
bolo up
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”