Log In

Your email is not your username

Register

If you were a member of the old Bodybuilding.com forums and would like to reuse your previous username, you can request it below. We use your email only for registration and do not store it. For more information, please see our Privacy Policy.

Confirm your email

A registration code was sent to your email. Enter it here.

Welcome

You have successfully setup your account.

Sign in

Quick Navigation Bottom Misc
Forum
ยป Anyone skilled in excel?
  1. Results 1 to 11 of 11
post 1674217253 01-05-2023, 10:11 PM
-
#1
  1. poptarts
  2. Registered User
  1. poptarts
  2. Registered User
  3. Join Date: Aug 2012
  4. Posts: 2,955
  5. Rep Power: 15956

Anyone skilled in excel?

I want to simulate playing mega millions. The megaball number is simple and I don't need help with it. I want 5 random numbers generated from 1 through 70. No duplicates in same row. I want matching numbers highlighted. I try to use the COUNTIF function but it will only highlight if the first cell in the block matches one of the numbers in the list of winning numbers and it will highlight the enter block instead of individual matching cells. I suspect it is because it is in conflict with the RANDBETWEEN function. Also, I don't know how to have it not create duplicate numbers in same row. Plz halp.
post 1674217603 01-05-2023, 10:19 PM
-
#2
  1. Bingo559
  2. Registered User
  1. Bingo559
  2. Registered User
  3. Join Date: Dec 2020
  4. Age: 56
  5. Posts: 1,746
  6. Rep Power: 8413
you probably need to use some other function nested with it.
post 1674217863 01-05-2023, 10:28 PM
-
#3
  1. poptarts
  2. Registered User
  1. poptarts
  2. Registered User
  3. Join Date: Aug 2012
  4. Posts: 2,955
  5. Rep Power: 15956
Originally Posted By Bingo559
you probably need to use some other function nested with it.
My work around is to create a rule for each number matching the mega millions winning number. I don't know how to make it work as one rule. GD easier to code it in java but I don't want to create a GUI just for this. Fk it I just might if nobody can teach me in excel.
post 1674218333 01-05-2023, 10:41 PM
-
#4
  1. ErnieMccracken
  1. ErnieMccracken
  2. Join Date: Nov 2013
  3. Posts: 100,062
  4. Rep Power: 330290
I use a simple macro for this, but it's probably simplest/easiest just to do it like how excel tells you:

1. In a blank worksheet, type column headers in Range A1:C1 as below screen shot shown:


2. Enter formulas in Column A, Column B, and Column C:


(1) In Cell A2, enter the formula =RAND(), and then drag the Fill handle to the range A2:A50.
(2) In Cell B2, enter the formula =RANK($A2,$A$2:$A$50)+COUNTIF(B$1:B1,B1)-1, and then drag the Fill Handle to the Range B2:B50. (In the formula, A2 is the random number left to current cell, $A$2:$A$50 are all random numbers we got with the first formula, B$1 is the first cell in Column B, and B1 is the cell above current cell).
(3) In Range C2:C50, enter sequence numbers from 1 to 49.

3. Find a blank range, type sequence numbers horizontally in a row as below screen shot shown:


4. Below the first sequence number of 1, enter the formula =VLOOKUP(G1,$B$1:$C$50,2,FALSE) into it, and the drag the Fill Handle to the Range you need.


5. It's optional. To prevent the lottery numbers from changing automatically when current worksheet refreshes, you can click the Formula > Calculation Options > Manual.
post 1674219223 01-05-2023, 11:02 PM
-
#5
  1. poptarts
  2. Registered User
  1. poptarts
  2. Registered User
  3. Join Date: Aug 2012
  4. Posts: 2,955
  5. Rep Power: 15956
[QUOTE=ErnieMccracken post_id=1674218333]I use a simple macro for this, but it's probably simplest/easiest just to do it like how excel tells you:

1. In a blank worksheet, type column headers in Range A1:C1 as below screen shot shown:
[img]https://i.imgur.com/tcJJAd1.png[img]

2. Enter formulas in Column A, Column B, and Column C:
[img]https://i.imgur.com/XWYHbqG.png[img]

(1) In Cell A2, enter the formula =RAND(), and then drag the Fill handle to the range A2:A50.
(2) In Cell B2, enter the formula =RANK($A2,$A$2:$A$50)+COUNTIF(B$1:B1,B1)-1, and then drag the Fill Handle to the Range B2:B50. (In the formula, A2 is the random number left to current cell, $A$2:$A$50 are all random numbers we got with the first formula, B$1 is the first cell in Column B, and B1 is the cell above current cell).
(3) In Range C2:C50, enter sequence numbers from 1 to 49.

3. Find a blank range, type sequence numbers horizontally in a row as below screen shot shown:
[img]https://i.imgur.com/EvyleE6.png[img]

4. Below the first sequence number of 1, enter the formula =VLOOKUP(G1,$B$1:$C$50,2,FALSE) into it, and the drag the Fill Handle to the Range you need.
[img]https://i.imgur.com/Q44MTyi.png[img]

5. It's optional. To prevent the lottery numbers from changing automatically when current worksheet refreshes, you can click the Formula > Calculation Options > Manual.
[img]https://i.imgur.com/3CXGGWY.png[img][/QUOTE]
This is what I'm working with:

Sometimes there will be duplicates within a row (each row equaling one ticket). How do I not have that happen?

[img]https://i.imgur.com/dwgFIXx.png[/img]
post 1674219783 01-05-2023, 11:22 PM
-
#6
  1. ErnieMccracken
  1. ErnieMccracken
  2. Join Date: Nov 2013
  3. Posts: 100,062
  4. Rep Power: 330290
Originally Posted By poptarts
This is what I'm working with:

Sometimes there will be duplicates within a row (each row equaling one ticket). How do I not have that happen?

The way you have it set up, you cannot do it without a macro function AFAIK. At at least I don't know how.

To do it with regular vanilla formulas, that's what the RAND and RANK formulas are for.

Cliffs:
1. Start with 69 rows of data, each with a RAND formula. You draw a bunch of RANDs, which are brought out to 9 decimals in this case to make sure there are no dupes..
2. In the next column, you take the RAND column and RANK them 1-69, so each drawn number now has a unique integer rank. Now you will have rank (column b) to go with your ball number (column c).
3. You pull in "winners" using the VLOOKUP formula.
post 1674219883 01-05-2023, 11:26 PM
-
#7
  1. DavidL913
  2. Registered User
  1. DavidL913
  2. Registered User
  3. Join Date: Nov 2006
  4. Age: 39
  5. Posts: 4,912
  6. Rep Power: 11937
Originally Posted By poptarts
I want to simulate playing mega millions. The megaball number is simple and I don't need help with it. I want 5 random numbers generated from 1 through 70. No duplicates in same row. I want matching numbers highlighted. I try to use the COUNTIF function but it will only highlight if the first cell in the block matches one of the numbers in the list of winning numbers and it will highlight the enter block instead of individual matching cells. I suspect it is because it is in conflict with the RANDBETWEEN function. Also, I don't know how to have it not create duplicate numbers in same row. Plz halp.
Do a Monte Carlo simulation using Python for this.
***Los Angeles MISC Crew***

***Misc Crypto Crew***
post 1674219923 01-05-2023, 11:28 PM
-
#8
  1. ErnieMccracken
  1. ErnieMccracken
  2. Join Date: Nov 2013
  3. Posts: 100,062
  4. Rep Power: 330290
Originally Posted By DavidL913
Do a Monte Carlo simulation using Python for this.
brb learning python to lottery sim

Also you can do monte carlo sim in excel ez pz, but only really useful if you're tabulating many results.
post 1674220353 01-05-2023, 11:43 PM
-
#9
  1. xbluexhawkx
  2. Registered User
  1. xbluexhawkx
  2. Registered User
  3. Join Date: Aug 2016
  4. Posts: 19,553
  5. Rep Power: 97479
Paging all financecels
Balanced Test Crew
post 1674220433 01-05-2023, 11:45 PM
-
#10
  1. ErnieMccracken
  1. ErnieMccracken
  2. Join Date: Nov 2013
  3. Posts: 100,062
  4. Rep Power: 330290
Originally Posted By xbluexhawkx
Paging all financecels
You should have seen our fantasy football spreadsheets. We bloatmaxxed it up to almost 200mb, looked like a terminal.
post 1674220553 01-05-2023, 11:50 PM
-
#11
  1. DomMJr
  2. Registered User
  1. DomMJr
  2. Registered User
  3. Join Date: Dec 2022
  4. Age: 56
  5. Posts: 7,380
  6. Rep Power: 23077
Just use VBA for whatever you want to say.
Quick Navigation Top Misc
Bookmarks
Digg.com
Digg
del.icio.us
del.icio.us
Stumbleupon.com
StumbleUpon
Google.com
Google
Facebook.com
Facebook
Posting Permissions
  1. You may not post new threads
  2. You may not post replies
  3. You may not post attachments
  4. You may not edit your posts