简体   繁体   中英

How to reference another cell in a chart based on an aggregating total in another cell

So, the title might be confusing, so I'll outline like this:

I am making a weightloss chart. One of the clients gets to open a bag of legos as a reward for every 2lbs that he loses, as long as he does it based on a goal progression. For instance, if he weights 260, and loses 2lb, he gets his reward. However, if he gains a lb, now he has to lose 3lb to get his reward.

Currently, I have charts that look like this:

Column O Column P
Current Weight Amount Lost
263 8
Column L Column M
Next Lego Bag 261
Lbs until next bag 2

After he hits 261, I want that cell that says 261 in Col M to say "259". So if he weighs in again, I want it to look like this automatically.

Column O Column O
Current Weight Amount Lost
260.5 10.5
Column L Column M
Next Lego Bag 259
Lbs until next bag 1.5

What is the best way to automatically make that cell in Column M change when he hits the 2lb goal? I have a table that basically states all the goal weighs he needs to hit for each reward. It looks like this:

| Column Z | Column AA | Column AB | (formatting is being weird)

| -------- | -------- | -------- |

| Bag | Target Weight | Amount Lost |

| Bag 5 | 261 | 8 |

| Bag 6 | 259 | 10 |

| Bag 7 | 257 | 12 |

| Bag 8 | 255 | 14 |

| Bag 9 | 253 | 16 |

etc

I've tried a few things, but I'm coming up blank, because it won't always be in whole numbers the amount he loses, so matching it to the target weight has been tough.

In really, really simple terms, I need it to basically say this: If current weight > goal 1, then A1 = goal 1. If current weight < Goal 1, then A1 = Goal 2, and all the way to Goal 21. However, A1 can't change to the next goal until current weight is less than that goal.

Thanks all

I have tried IF statements and Floor statements to get an ongoing changing thing, but it's not working.

In M2 : =IF(MOD(O2+1,2)=0,2,MOD(O2+1,2))

In M1 :

=O2-M2

Or using O365 in M1 :

=LET(m,MOD(O2+1,2),
     lbs,IF(m=0,2,m),
     VSTACK(O2-lbs,lbs))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM