Tally Macro

moe10134

Board Regular
Joined
Sep 8, 2005
Messages
162
Office Version
  1. 2019
Platform
  1. Windows
Hello,

i am looking for a function, formula or macro that allows me to tally results of a RAND()+1 in A2. Using =MROUND(A2,1) in B2. I will either get a result of 1 or 2 in B2. I am looking for a way to give me a total/count/sum (recorded tally) of how many times I get a result of 1 or how many times I get a result of 2. This could also be a TRUE or FALSE result. I'm looking to tally or keep track of a total of how many times a 1 or 2 result. If I get a result of 1 three times a cell will total to 3. If I get a result of 2 five times a cell will total 5 and continue to sum/count each time RAND() runs and I get each 1 or 2 result. It can be in separate cells as a range to SUM. One cell to count 1's and/or One cell to count 2's. Or a Macro that each time the result is 1 or 2 then it will total each result to be recorded and continue to sum the number of times I get a 1 or 2 result. I can also use an IF statement to equal a text result of "Yes" or "No" =If(b2=1,"yes","no") but i still need to determine how many times I get a specific result.

The function/macro/formula, I am looking for is to total each time a new 1 or 2 result appears.

Anyone have any suggestions?

Thank a bunch!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
HI,

Would countifs($B:$B,B2) work in column c.

However it does seam to recalculate when copying the formula down.

Regards,

Dan.
 
Upvote 0
Thanks for the suggestion. The random number 1 or 2 generates in the same cell. I can do it manually and put anything I want into a Range of cells and =countif it, but I'd like it to automatically generate a ongoing total or count each time it changes. I'd like it to calculate on it's own. Each time I open the file or type in a cell and push Enter, it randomly generates a 1 or 2 in B2. I need to program it to count each time it changes from a 1 to 2, 2 to 1, 2 to 2, etc. and determine if the number was a 1 or a 2. It can either populate as a running total how 1 and 2 in one cell or populate as 1 or 2 in a Range to sum/countif/subtotal/etc.

Anyone have any macro ideas to auto-populate a ongoing countif in the same cell or populate a list?

Thanks for all your help!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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