Jump to content

Excel Logic Problem - Circular Reference

Not strictly a language specific question, but a logic problem I think best fits to Programming.

I am trying to make an Excel sheet that helps plan a character in a game.

 

The Total Stat is the sum of the Base Stat and Bonuses applied.

The game has items that can only be equipped if the Total Stat meets or exceeds a value.

Once the item is equipped, it can add to the Bonuses that in turn increases the Total Stat.

 

Capture.PNG.036c8433292330ec8b13d23a291674c9.PNG

 

I cannot for the life of me figure out the logic that avoids a circular reference since the total is dependent on the bonuses which is turn dependent on the total and so on... 😵

Link to comment
https://linustechtips.com/topic/1377068-excel-logic-problem-circular-reference/
Share on other sites

Link to post
Share on other sites

23 minutes ago, darkDOS said:

I cannot for the life of me figure out the logic that avoids a circular reference since the total is dependent on the bonuses which is turn dependent on the total and so on...

Surely there's some kind of "base total" that is used to calculate the bonuses, which are then used to calculate the overal total. You need to distinguish between those two values.

 

If your total increases your bonuses, which in turn increase your total, you have an endless loop which increases continuously. That would mean it would always go towards infinity.


Here's how it should work:

BASE = some value
BONUS = $BASE * factor
TOTAL = $BASE + $BONUS

EXTRA-BONUS = IF ($TOTAL > X; 123; 0)
REAL_TOTAL = $BASE + $BONUS + $EXTRA-BONUS

image.png.4a8201665947be8711e5f6ed8d91a5c8.png

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

21 minutes ago, Eigenvektor said:

Surely there's some kind of "base total" that is used to calculate the bonuses, which are then used to calculate the overal total. You need to distinguish between those two values.

 

If your total increases your bonuses, which in turn increase your total, you have an endless loop which increases continuously. That would mean it would always go towards infinity.

The bonus is not calculated, the bonus on the item is a fixed number. The bonuses are applied *if* the item is equipped. 

 

So, as an example you had two items:

Item 1 requires 10 total stat and if equipped applies a 10 bonus.

Item 2 requires 20 total stat.

 

When the total reaches 10, you will be able to equip Item 1 and then in turn Item 2 due to the bonus applied from Item 1.

Worth noting, this is performed in one iteration meaning the bonus is only applied once if applied at all.

Perhaps that is maybe the issue with trying to do the calculation in Excel?

 

/edit

 

I have to experiment with your example. It looks promising, will report back.

 

Link to post
Share on other sites

13 minutes ago, darkDOS said:

So, as an example you had two items:

Item 1 requires 10 total stat and if equipped applies a 10 bonus.

Item 2 requires 20 total stat.

This should do it:

image.png.8a80f1f2df71781256a74221273a17d0.png      image.png.99978ee14d49547cfbbe595874d10426.png

 

The final total includes the total and the additional bonuses from the items. The items are only applied when the total (excluding those items) exceeds a threshold.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

  • 2 months later...
On 9/29/2021 at 6:57 PM, darkDOS said:

Not strictly a language specific question, but a logic problem I think best fits to Programming.

I am trying to make an Excel sheet that helps plan a character in a game.

 

The Total Stat is the sum of the Base Stat and Bonuses applied.

The game has items that can only be equipped if the Total Stat meets or exceeds a value.

Once the item is equipped, it can add to the Bonuses that in turn increases the Total Stat.

 

Capture.PNG.036c8433292330ec8b13d23a291674c9.PNG

 

I cannot for the life of me figure out the logic that avoids a circular reference since the total is dependent on the bonuses which is turn dependent on the total and so on... 😵

Hi,

have you tried enabling the iterative calculation in the option section?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×