Skip to Main Content
Computing with Excel and VBA
book

Computing with Excel and VBA

by S.I. Krishan
August 2008
Beginner to intermediate content levelBeginner to intermediate
298 pages
10h 49m
English
Jones & Bartlett Learning
Content preview from Computing with Excel and VBA
Dealing with Errors 263
wt = wt * 0.4536
‘Convert height(ht) into Meters
ht = ht * 0.0254
‘Now compute BMI
BMI = wt/ht^2
End Function
As you can see, the code for the function is straightforward. Let us use this function in
our Excel worksheet by typing the following formula in cell A1:
=BMI(200, 73)
As soon as you enter the formula, Excel will display 26.38699 in cell A1, the BMI of
a person who weighs 200 pounds and is 73 inches tall.
Since BMI is declared a Public function, Excel includes it in the list of built-in func-
tions, and you can access it just like any other Excel function, through the Insert Function
dialog box as shown in Figure 11.15
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel Programming with VBA Starter

Excel Programming with VBA Starter

Robert F Martin
Programming Excel with VBA and .NET

Programming Excel with VBA and .NET

Jeff Webb, Steve Saunders

Publisher Resources

ISBN: 9780763756680