0:00 In this video I'm going to show you how to calculate BMI, but I'm also going to show you how to create a BMI calculator, and actually a BMI formula that's going to be native to your sheet.

0:11 We're going to go into a little bit of Apps Script at the end, but let me show you the formula we're going to start to use.

0:16 We have a weight in pounds, height in inches, and our formula is going to be 703 times, we're going to take the weight, and we're going to divide it by, in parentheses, the height squared.

0:32 And there we get our BMI. I'm going to do a couple of things to this to make sure that we have a nice number.

0:38 We're going to format this number. We're going to format it as a number, and we can actually get it down to just a single number.

0:48 We can probably add a couple of decimal points if we want, and there is like a nice BMI number. But how do we do this, where we want it to essentially be a formula?

1:00 Like, we want to be able to go equal BMI, and something comes up. How will we do this? We'll go up to extensions, Apps Script, and in Apps Script, we can create a formula.

1:17 We're going to call our function BMI. We're going to take in a weight and a height and And then we're going to return BMI.

1:29 Well, we have to actually calculate BMI. We'll get that as well, so we'll go variable BMI equals. We'll take in the weight.

1:37 We'll do the exact same formula, 7-0-3 times weight divided by height squared. And let's save this and let's see if this works.

1:55 Are we going to get the same number? Equals BMI And we'll select each of these options, it'll load, and we get something else.

2:07 Ah, to do the exponential, realize we have to do this, two asterisks. Let's go check our BMI calculation. It is perfect.

2:16 We can actually replace it here and see that we get the same number. Did we get the same number? There we go.

2:27 So, how do we make this a function that is native? We're going to just add a comment, slash, asterisks, asterisks, and we're going to go custom function, at sign custom function.

2:38 We'll save this, and now, let's delete these BMIs, and go equal BMI, and now it is here. We can actually see that we can select this from, ah, as a formula.

2:51 We can also give it this weight and height is going to show up here, so whatever we write here, weight and height, is going to show up in our function as well.

3:00 So now. BMI is a native function, we just have weight in pounds, and height in inches, and we can get a BMI, as a native function.

3:10 Isn't that awesome? This is really cool. If you're a BetterSheets member, and you're watching this on BetterSheets.co, down below, you can get this exact sheet, and this exact Apps Script.

3:19 If you're not yet a member, become a member today, over at BetterSheets.co.