Karn Ish Excel 3

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 5

The IF Statement: an introduction

Sample data
Letter Grade Numerical Range
A 90-100 90
B 80-90 80
C 70-80 70
D 60-70 60
F <60

IF statement syntax (Displays when you double click on the IF statement)

IF(Logical_test, [value_if_true],[value_if_false])
IF(perform logical test, [if result of logical test is true then perform this action], however [if result of logical test is false then perform this action])
AND(C5="A",C6="B) returns true value if all of its arguments are true
OR(C5="A",C6="D") returns true value if either one or both of its arguments are true
TRUE Returns the logical value TRUE (Quotation marks not required)
FALSE Returns the logical value FALSE (Quotation marks not required)

Statement logical_test true logical_test false


IF(C5="A",True) 1 IF(C5="B",True) FALSE
AND(C5="A",C6="B") 1 AND(C5="A",C6="C") FALSE
IF(AND(C5="A",C6="B"),Tr 1 IF(AND(C5="A",C6="D"),T FALSE
OR(C5="A",C6="D") 1 OR(C5="B", C6="A") FALSE

Student Term Grade Test for an A Test for a B Test for a C Test for a D Test for a failure
Nathan 90 A Not a B Not a C Not a D No Worries - you passed
Kira 85 Not an A B Not a C Not a D No Worries - you passed
Kimia 72 Not an A Not a B C Not a D No Worries - you passed
Chad 63 Not an A Not a B Not a C D No Worries - you passed
Horatio 59 Not an A Not a B Not a C Not a D Study Harder

Can we accomplish the same test with only one IF statement?


We can - with the use of a nested IF statement

IF Statement:
Logical Test for A grade
Action if True Action if False
Exit IF & Return IF Statement:
a value of "A" Logical Test for B grade
Action if True Action if False

Exit IF & Return IF Statement:


a value of "B" Logical Test for C grade
Action if True Action if False
Exit IF & Return IF Statement:
a value of "C" Logical Test for D grade
Action if True Action if False
Exit IF & Return Exit IF & Return
a value of "D" a value of "F"

Note: Can use up to 64 nested IF statements within one IF statement

Student Term Grade Letter Grade


Nathan 90 A
Kira 85 B
Kimia 72 C
Chad 63 D
Horatio 59 Study Harder
Problem:
Calculate the radius of a right circular cylinder of height h corresponding to a given total surface area A

Define and name variables steps to proceed


Description name value units
height (h) 20 mm
area (Area) 4000 mm2 get values for a,b,c

Spreadsheet Calculations yes


Equations for Right Cylinder Area (Use Microsoft Equation Editor) b^2-4ac<0 solution is imaginary
no
Equations for Right Circular Cylinder yes
equations are b^2-4ac=0 r1=r2=-b/2a
Area  2 r 2  2 rh
𝐴=2𝜋𝑟^2+2𝜋𝑟ℎ
where r is the radius and h is the height no
0=2𝜋𝑟^2+2𝜋𝑟ℎ−𝐴 h
rewrite as quadratic equation 𝑟1=(−𝑏−√(𝐷))/2𝑎
comparing to quad formula 𝑟2=(−𝑏+√(𝐷))/2𝑎
2 r 2  2 hr  A  0
Quadratic Equation
compare to 〖𝑎𝑥〗 ^2+𝑏𝑥+𝑐 2r
ax2+bx+c
ax 2  bx  c
a  2 Area  2r 2  2rh
b  2 h , and
c  A

When solving for the discriminant D=b 2-4ac, there are 3 possibilities
1) D > 0, there are two distinct roots
2) D < 0 , there are two conjugate imaginary roots
3) D = 0, there are two equal roots

Get values of a,b, and c


units
a= 6 unitless
b= 126 mm
c= 4000 mm2

Calculate value of Discriminant

D= -84740

r1= Solution is imaginary mm


r2= Solution is imaginary mm

Only the positive root makes physical sense, therefore

r= Solution is imaginary mm
Hydraulic Elements Chart for a Circular Pipe
Input Parameters Full Pipe Values Conduit Material
Pipe Diameter, D 4.0 m vfull m/s
Slope of EGL, S 0.10 Qfull m3/s
Roughness, n 0 Afull m2
Rfull m
Pfull m

y y/D v Q v/vfull Q/Qfull A/Afull R/Rfull theta P


(m) (m/s) (m /s)
3
(radians) (m)
Conduit Material

A R
(m 2)
(m) Hydraulic Elements for a Circular Pipe
12.000
Smooth Concrete Lining 0.012
Planed timber 0.012
10.000 Lined cast iron 0.012
Ratio of Flow Depth to Diameter (y/D)

Good vitrified sewer pipe 0.013


Average concrete pipe 0.013
8.000
Unplaned timber 0.013
Average clay sewer pipe 0.015
6.000

4.000

2.000

0.000
0.000 2.000 4.000 6.000 8.000 10.000

Hydraulic Elements Relative to Full Pipe Flow

velocity discharge area hydraulic radius


Pipe

8.000 10.000 12.000

ow

draulic radius

You might also like