# Math/Excel Formula Wizards

**URL:** <https://forums.speedlife.net/t/math-excel-formula-wizards/269766>\
**Category:** NYSpeed Off Topic\
**Created:** [June 20, 2014, 1:57pm UTC](https://forums.speedlife.net/t/math-excel-formula-wizards/269766 "2014-06-20T13:57:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ProgRocker](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/progrocker/32/5434_2.png) [@ProgRocker](https://forums.speedlife.net/u/ProgRocker)\
**Post date:** [June 20, 2014, 1:57pm UTC](https://forums.speedlife.net/t/math-excel-formula-wizards/269766/1 "2014-06-20T13:57:58Z")

</div>

I’m working on creating a Excel (Google Sheets actually) version of my brother’s diabetes chart. ([SEE HERE](https://docs.google.com/spreadsheets/d/10xhX-Y1UTpTkhibWHegGhMqtdT9Rr-oDSamQ_JCFxyo/edit?usp=sharing))

So basically the Bolus cells are the total after you figure out the calculation.

The BG is Blood Glucose taken from the blood sugar tester. That number is a static number  
Carbs is based off of the food you’re eating. The conversion to insulin is One unit for every 8 Carbs or 1:8. It’s 1:12 for lunch time at school.  
Then if he’s over a certain amount of blood sugar (BG cell) he’ll have to do a correction (more units of insulin) It’s 1 unit for every 40/120BG

So the total should be something like

(Carbs/8)  
+  
(If BG \< 120, then 0. If BG \> 120, For Every 40, add 1) \<- obviously this part I need help with.

---

<div class="post-metadata">

**Author:** ![ProgRocker](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/progrocker/32/5434_2.png) [@ProgRocker](https://forums.speedlife.net/u/ProgRocker)\
**Post date:** [June 20, 2014, 3:01pm UTC](https://forums.speedlife.net/t/math-excel-formula-wizards/269766/2 "2014-06-20T15:01:08Z")

</div>

Might have figured this out myself. Here is the formula for the very first Bolus cell (E5)

```auto
=IF(AND(E3&lt;=120),E4/8,IF(AND(E3&gt;120,E3&lt;=160),E4/8+1,IF(AND(E3&gt;160,E3&lt;=200),E4/8+2,IF(And(E3&gt;200,E3&lt;=240),E4/8+3,If(AND(E3&gt;240,E3&lt;=280),E4/8+3,IF(AND(E3&gt;280,E3&lt;=320),E4/8+4,IF(AND(E3&gt;320,E3&lt;=360),E4/8+5,IF(AND(E3&gt;360,E3&lt;=400),E4/8+5,IF(AND(E3&gt;400,E3&lt;=440),E4/8+6,IF(AND(E3&gt;440,E3&lt;=480),E4/8+7,IF(AND(E3&gt;480,E3&lt;=520),E4/8+8)))))))))))

```
