change variables
1 TopicChanging a variables and stored values based on looping conditions that compares 2 objects?
Is it possible to create a loop that checks a condition and then applies new values to the original variables? More specifically I have cross-joined a table to compare elements against each other and based on that first comparison they are then compared again and their values are reduced until one of the two comparisons hits zero which will then do an If statement to label the “winning” element of the two based on the percentage of its starting value that remains for the “winner”. Here is an example of the data: Elements to Compare Numeric Value Change Starting Value Obj Change Value AW .75 6 CR 4.44 40 I’d need the above info do the following Compare each element against each other to be placed in a matrix with your element of choice on the first column and the opposing element as the headers of each other column. Each cell between them will initially look at the “starting value” minus the “numeric value change” and return the result. E.g. AV with a starting value of 6 is compared to CR with a Numeric Value Change of 4.44 the compared value for “round 1” is 6 - 4.44 displaying 1.56 as the remainder going into “round 2”. CR would also have its starting value of 40 and subtract the Numeric value Change from AW (.75) leaving the “Round 2” starting value for CR as 40 - .75 at 39.25 starting value for CR. It will then take that results from “Round 1” and then alter the starting values to subtract the numeric value change again. Same elements would now be AW vs CR but AW = 1.56 Starting value instead of 6 and CR’s new starting value would be 39.25 It will run through the calculations again 5 times or until one of the two elements hit’s 0 first. AW Starting Value vs CR Numeric Value Change = 1.56 – 4.44 resulting in AW new starting value for round 2 stored as -2.88. CR Starting Value vs AR Numeric Value Change = 39.25 - .75 resulting in CR new starting value of 38.5 Since Round 2 ends with AW “starting value” as less than 0 the loop would end and then declare CR the standing element at (New Starting Value of 38.5/Original Starting Value of 40)*100 or at 96.25% remaining “Starting Value. As a measure it could then run this comparison in the matrix after cross-joining the duplicated tables unless someone has a better alternative for that as well? Big goal here is knowing if I can loop the formula and update the variables for “Starting” values while pulling in the variable for “Numeric Value Change” which may or may not have that value changed as the “starting value decreases over time or “Rounds” Can we update variables with new values and step through or loop to continue calculating the result until a final value of 0 for one of the two compared elements is achieved or 5 rounds of comparisons have passed?2KViews0likes3Comments