Excel formula for "result of 2-7 on the die is always treated as if you rolled an 8" - excel

I have a spreadsheet program which rolls twenty-sided dice. Sheet 1 is Rolls and Sheet 2 is Values.
I want to roll a d20, but if it comes up 2-7, fudge it and assume I got 8 instead.
Rolls!A2's function is =RANDBETWEEN(1,20) which returns a random number between 1 and 20 to represent the d20 roll. Values!7E is function which calculates a (non-random) number (currently 13).
Currently, Rolls!C7's function attempts to calculate my result with =Values!E7+Rolls!A2. But I would like to update Rolls!C7 to reflect the fudging. If Rolls!A2 returns numbers 2, 3, 4, 5, 6, or 7, Rolls!C7 would instead be calculated as if it rolled an 8.

Replace Rolls!A2 in your formula with this: IF(AND(Rolls!A2<8, Rolls!A2>1),8,Rolls!A2) this way it will always be at least 8 unless a 1 is rolled.

Or you could do =IF(Rolls!A2=1,1,MAX(Rolls!A2,8))

Related

How to change count after certain value

I'm trying to write a code in Excel that basically counts multiplies valueA by 5 when ValueA<=15. Once valueA surpasses 15 (therefore ValueA>15), it will the multiply ValueA by 9 for the remaining amount value. For example, if ValueA=20, 1-15 will be multiplied by 5, and the 16-20 will be multiplied by 9, to give the total amount.
Can anybody else out with this?
So far, I have:
=IF(AND(A2="LR",B2<=15),B2*5, IF(AND(A2="LR",B2>16....
not sure how to finish off!
=IF(AND(A2="LR",B2<=15),B2*5, IF(AND(A2="LR",B2>15),B2*9-75, ... Whatever value you want if A2 doesn't equal LR))

excel formula to convert a number between 0-5 as 5 and 5-10 as 10 etc

I want to write a logic in excel that if value in a call is between 0 and 5 then the cell takes value as 5, if it is between 5 and 10 then the value taken is 10 and so on. How can I do this?
Try the int formula
=(INT(C5/5)+1)*5

origin value and after sum after ROUND() is different

I have a table with "ordered amount", "percentages", and "total sum". Note that "ordered amount" and "total sum" should be the same.
column F= sum of C:F
*rows 4,6,8,10 used =round()
As shown in the table(image), for some numbers, value in F is not the same as A when it should be. (e.g. A6(105) and F7(104), -1 after rounding).
Is there anyway to avoid this?
Thank you very much.
If the sum of the decimal points adds up to > 5, your final rounded number will round up. If they add up to < 5, the final number will round down.
Consider this example:
10.5 + 5 = 15.5, which rounds to 16.
However
10 + 5 = 15
This is what is happening in your table.
In order to get the sum of rounded numbers to add up to the same as the sum of the numbers, in your example, you will need to NOT round, but rather subtract, one of the values. I would suggest altering the largest value, as it would seem to have the least effect on the percentages, but that is a choice you can make.
To do that, with your data in row 8, for example you could do the following.
A9: =IF(B$8=MAX($B$8:$E$8),SUM($B$8:$E$8)-SUM(ROUND($B$8:$E$8,0))+ROUND(B$8,0),ROUND(B$8,0))
entered as an array formula with ctrl+shift+enter and fill right to E9.
This would give a sum of 344 which is the same as F8

Explain the CEILING function for dates

I have a formula which gives me different dates depending on the multiplier. I am not sure how it works though, except that it rounds a date. The formula is the following:
=DATE(YEAR($L$4),CEILING(MONTH($L$4),2),0)
So imagine today´s date is 18/08/2015 in cell L4. If i change the multiplier i get the following results:
=DATE(YEAR($L$4),CEILING(MONTH($L$4),2),0) = 31/07/2015
=DATE(YEAR($L$4),CEILING(MONTH($L$4),3),0) = 31/08/2015
=DATE(YEAR($L$4),CEILING(MONTH($L$4),4),0) = back again to 31/07/2015.
Why does this happen? Why does it go back to 31/07/2015 if the multiplier increases to 4?
=CEILING('number', 'multiple') returns a multiple of the 'multiple' that is nearest to the 'number'.
Since MONTH evaluates to 8 or August, you would have =CEILING(8, 3), which evaluates to 9, because 9 is the multiple of 3 closest to 8. 2 and 4 as multiples will both return 8.
=DATE(2015, 9, 0) will return the last date of the previous month, because the day is 0.
If you tried your formula with CEILING(MONTH($L$4), 10), you would get 31/9/2015, because the multiple of 10 nearest to 8 is 10, and the DATE formula will end up looking like =DATE(2015, 10, 0) which evaluates to 31/9/2015.
As a side note, the button below is very helpful in analyzing the formulas that you select in the excel chart.

IF THEN Statement Multiple Conditions

I'm trying to design an excel formula for some golf game scores. Golfers get points based on a random number (0-9) and the last digit of their score. So, if the random number is 0 and the golfers score ends in 0, they get 10 points. Still with a 0 random number, if the golfers score ends in a 1, they get 9 points. 8 points for a last digit of 2. 7 for 3. 6 for 4. 10 for 5. 9 for 6. 8 for 7. 7 for 8. 6 for 9.
Score ends in: Points:
0 10
1 9
2 8
3 7
4 6
5 10
6 9
7 8
8 7
9 6
As long as I come up with one formula for the random number of 0, I can adjust it for the remaining 9 random numbers.
The way I was hoping for this to work was to just be able to enter the scores into one column and then have the points calculated in a separate column. There will also have to be a cell where I enter the random number.
Any help is appreciated!
You can use something like this to get the score if the random number is 0:
=IF(A1=0,10-MOD(RIGHT(B1),5))
This will give the points you mentioned provided:
A1 is the cell containing the random number
B1 is the cell containing the points of the golfer.
The main formula here is:
10-MOD(RIGHT(B1),5)
RIGHT() takes the last digit of the points. MOD(,5) will get the remainder when this digit is divided by 5.
When you have 0, you get no remainder, hence 0.
When you have 1, you get a remainder of 1, hence 1.
When you have 2, you get a remainder of 2, hence 2.
When you have 6, you get a remainder of 1, hence 1 again.
Then 10 minus that remainder gives you the points you're looking for.
You could certainly use =RAND()*10to get a random value in excel. Or to get a value without commas use = ROUNDDOWN(RAND()*10;0)
Then you add something a VLOOKUPto get a value to each players score. RIGHT(A1;1)gives you the last value of a field.
VLOOKUPrequires you to have a table somewhere with the values for each score as you described.
edit: the MOD solution looks even better. Please note that RANDOM gets a fresh value everytime you refresh the XLS sheet. so probably use it to get a value and put that into another field manually.

Resources