![]() |
How do I replace data in a cell in Excel?
Ok...Here goes. Finally got this really nice IF statement to work:
=IF(A2(6/7), 1, IF(A2(5/7), 2, IF(A2(4/7), 3, IF(A2(3/7), 4, IF(A2(2/7), -1, IF(A2(1/7), -2, 0)))))) This is in cell B2 Assigns a value to a random number in A2, and gives seven different outputs of +1, +2, +3, +4, -1, -2, -ALL What I want to be able to do is have one cell keep like a running total. That is, start a cell at zero (we'll say C2), then if the random number is between 6/7 and 1, add 1 to the C2. Then when i hit F9 again and a new value comes up, for example, the random number is between 4/7 and 5/7, add 3 to C2 so that now it says 4. Is this possible? I tried: =IF(A2(6/7), C2=(C2+1), IF(A2(5/7), C2=(C2+2), IF(A2(4/7), C2=(C2+3), IF(A2(3/7), C2=(C2+4), IF(A2(2/7), C2=(C2-1), IF(A2(1/7), C2=(C2-2), 0)))))) And other variations. Also tried in C2 : =$C$2+B2 and =C2+B2 but those just start a circular reference. Thanks for any help. |
There's nothing wrong with a circular reference, but you need to be able to
manage it. Go to Tools|Options|Calculation, check Iteration, change Maximum iterations to 1 and Maximum change to 4. -- Ian -- "Logan" wrote in message ... Ok...Here goes. Finally got this really nice IF statement to work: =IF(A2(6/7), 1, IF(A2(5/7), 2, IF(A2(4/7), 3, IF(A2(3/7), 4, IF(A2(2/7), -1, IF(A2(1/7), -2, 0)))))) This is in cell B2 Assigns a value to a random number in A2, and gives seven different outputs of +1, +2, +3, +4, -1, -2, -ALL What I want to be able to do is have one cell keep like a running total. That is, start a cell at zero (we'll say C2), then if the random number is between 6/7 and 1, add 1 to the C2. Then when i hit F9 again and a new value comes up, for example, the random number is between 4/7 and 5/7, add 3 to C2 so that now it says 4. Is this possible? I tried: =IF(A2(6/7), C2=(C2+1), IF(A2(5/7), C2=(C2+2), IF(A2(4/7), C2=(C2+3), IF(A2(3/7), C2=(C2+4), IF(A2(2/7), C2=(C2-1), IF(A2(1/7), C2=(C2-2), 0)))))) And other variations. Also tried in C2 : =$C$2+B2 and =C2+B2 but those just start a circular reference. Thanks for any help. |
All times are GMT +1. The time now is 06:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com