<aside> 💁🏼 Template created on July 13, 2021 in an attempt to help redditor u/Almond_knows with [this question](<https://www.reddit.com/r/Notion/comments/oj55tn/how_to_build_a_calculator_with_if/>). Feel free to duplicate the template or leave comments! :)

</aside>

BMR Calculator (Table)

Formula: **BMR**

<aside> 💡 Make sure your columns are named the same as mine before copying the following formula directly into your table. After that, you may rename the columns. You may also duplicate this whole page.

</aside>

if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 18, 12.2 * prop("Weight (kg)") + 746, if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 30, 14.7 * prop("Weight (kg)") + 496, if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 60, 8.7 * prop("Weight (kg)") + 829, if(prop("Sex") == "🚺 Female" and prop("Age (years)") > 60, 10.5 * prop("Weight (kg)") + 596, if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 18, 17.5 * prop("Weight (kg)") + 651, if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 30, 15.3 * prop("Weight (kg)") + 679, if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 60, 11.6 * prop("Weight (kg)") + 879, if(prop("Sex") == "🚺 Male" and prop("Age (years)") > 60, 13.5 * prop("Weight (kg)") + 487, toNumber("Whoops! Something is missing!")))))))))

<aside> ⚠️ *Note: Does a person whose age is 18 belong to the first or second age range? To avoid this ambiguity and simplify the formula, I have re-defined the age ranges to: ≤18, ≤30, ≤60 and >60.

This might need some adjustment.*

</aside>

Formula & Comments: **BMR**

<aside> 💡 The following code is not meant to work on Notion. It's just supposed to help us visualize what's happening within all that code. Use it for reference only. :)

</aside>

# if sex is female and age is less than or equal to 18, multiply 12.2 by the person's weight and add 746 to that. Otherwise, try the next line.
if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 18, 12.2 * prop("Weight (kg)") + 746, 
if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 30, 14.7 * prop("Weight (kg)") + 496, 
if(prop("Sex") == "🚺 Female" and prop("Age (years)") <= 60, 8.7 * prop("Weight (kg)") + 829, 
if(prop("Sex") == "🚺 Female" and prop("Age (years)") > 60, 10.5 * prop("Weight (kg)") + 596, 

if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 18, 17.5 * prop("Weight (kg)") + 651, 
if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 30, 15.3 * prop("Weight (kg)") + 679, 
if(prop("Sex") == "🚺 Male" and prop("Age (years)") <= 60, 11.6 * prop("Weight (kg)") + 879, 
if(prop("Sex") == "🚺 Male" and prop("Age (years)") > 60, 13.5 * prop("Weight (kg)") + 487, 

# if none of the above conditions were met, probably something is missing or incorrect. If that's the case:
toNumber("Whoops! Something is missing!")))))))))