bmi(body mass index)

2
Problem 2 Concepts – Create macro, obtain data from workshee ts, output data to worksheet s, InputBox Difficulty level – Easy-Medium Complete this problem on Sheet2. The Body Mass Index (BMI) score is used by doctors as a very rough measure of a person’s health and can be calculated using the following formula: 2 (height) weight 703 BMI  × =  Weight has units of pounds and height is in inches. For example, if you weigh 150 lbs and are 5' 5", which is 65 inches, your BMI score would be, 96 . 24 65 150 703 2  = ×  You will create a macro named B M I  that calculates a person’s BMI score. For the height, i nput the number of feet in cell A2 and the number of inches in cell B2. For example, if a person is 6' 2", type 6 into A2 and 2 into B2. The BMI  macro will accomplish the following tasks: • Obtain the values for feet and inches from cells A2 and B2, and s tore the values in variables • Calculate the person’s total height in inches and store this value in a variable (hint: there are 12 inches in a foot) • Obtain the person’s weight using an input box and store this value in a variable • Calculate the person’s BMI score and output this value to cell D2 Create a run button on Sheet2 that executes the macro B M I . Be sure to input the values of feet and inches into cells A2 and B2 before clicking the run button. If you would like to learn more about the BMI metric, you can visit the following website: http://en.wikipedia.org/wiki/Body_mass_index  

Upload: cristiam-velez

Post on 07-Jan-2016

4 views

Category:

Documents


0 download

DESCRIPTION

macro

TRANSCRIPT

7/17/2019 Bmi(Body Mass Index)

http://slidepdf.com/reader/full/bmibody-mass-index 1/1

Problem 2

Concepts – Create macro, obtain data from worksheets, output data to worksheets, InputBox

Difficulty level – Easy-Medium

Complete this problem on Sheet2.

The Body Mass Index (BMI) score is used by doctors as a very rough measure of a person’s health and can be

calculated using the following formula:

2(height)weight703BMI   ×=  

Weight has units of pounds and height is in inches. For example, if you weigh 150 lbs and are 5' 5", which is 65 inc

your BMI score would be,

96.2465

150703

2  =×  

You will create a macro namedBMI  that calculates a person’s BMI score. For the height, input the number of feet

cell A2 and the number of inches in cell B2. For example, if a person is 6' 2", type 6 into A2 and 2 into B2. The BMI

macro will accomplish the following tasks:• Obtain the values for feet and inches from cells A2 and B2, and store the values in variables

• Calculate the person’s total height in inches and store this value in a variable (hint: there are 12 inches in a foot

• Obtain the person’s weight using an input box and store this value in a variable

• Calculate the person’s BMI score and output this value to cell D2

Create a run button on Sheet2 that executes the macro BMI . Be sure to input the values of feet and inches into ce

A2 and B2 before clicking the run button.

If you would like to learn more about the BMI metric, you can visit the following website:

http://en.wikipedia.org/wiki/Body_mass_index