Experiment 3 & 4
Experiment 3 & 4
Experiment 3 & 4
Conditional Functions:
Logical Expressions, Boolean Functions, IF Function, Creating a Quadratic
Equation Solver, Table VLOOKUP Function, AND, OR and XOR function.
A logical expression is a statement that can either be true or false. For example, a < b is a
logical expression. It can be true or false depending on what values of a and b are given.
Logical expressions (also called Boolean expressions) are the result of applying logical
(Boolean) operators to relational or arithmetic expressions.
Example IF Function:
Category Budget Actual Status
Airfare 600 525
food 350 296
Entertainment 250 1500
Output:
X= (-b +/-SQRT(b^2-4ac))/2a
x1 -0.33
x2 -1
In column X1
Type = (-E8+SQRT (E8^2-4*E7*E9))/ (2*E7) x1 value displays
Similarly In column X2
OUTPUT: X1=-0.33
X2=-1
a 6
b 8
c 2
x1 -0.33
x2 -1
VLOOKUP Function:
The VLOOKUP function is a premade function in Excel, which allows searches
across columns.
order No product unit price quantity
10247 apple 14 12
10249 oranges 10 10
10250 banana 34 5
10251 pears 18 9
10252 grapes 42 40
10249 oranges 10 10
10250 banana 34 5
10251 pears 18 9
10252 grapes 42 40
10249
And Function:
=IF(AND(E6>=0,E6<=40),"Fail",IF(AND(E6>=40,E6<=60),"Pass",I
F(AND(E6>=60,E6<=100),"Distinction","Inalid")))
OR and XOR function:
Now the OR operator is saying, if the first argument or the second
argument are true, then the result is true.
Place cursor on any cell then type below conditions, result true or false displays.
=OR(1>2) FALSE
=OR(1>2,2>3) FALSE
=OR(2<3) TRUE
=OR(1<2,2<3) TRUE
Lastly, the XOR (exclusive OR) operator is saying, if input is true, then
the result is true, but if both inputs are true, then the result is false.
select all X & Y values, go to Insert then go scatter and select scatter with
straight line markers, the below graph displays.
700
600
500
400
Series1
300
200
100
0
0 1 2 3 4 5 6
Then on straight line click right button of mouse, go to add Trend line, select
Linear then select display equation on chart then below graph displays.
600
500
400
y = 50x + 125 Series1
300 Linear (Series1)
200
100
0
0 1 2 3 4 5 6
Click on any cell of excel sheet type =slope(select all values of Y column then
put comma then select all values of X column) then atlast press enter the answer
of slope 4 displays
Interpolation FORMULA=B6+(B13-A6)*((B7-B6)/(A7-A6))
Forecast=FORECAST(B13,B1:B8,A1:A8)
Note B13 means select X value
Interpolation =96.2
Forecast= 95.7
X Y
1 2.94
2 5.41
3 7.12
4 9.08
5 11.32
6 13.56
Select both X and Y values leaving X and y
Go to insert command then scatter then scatter with only markers graph displays
Right click on the any scatter point of graph add TREADLINE then select
Linear then put right mark on display equation on chart then display R 2 value on
chart.
=LINEST (D6:D11, C6:C11, FALSE, TRUE) first select all y values then x
values
Multilinear Regression:
Multiple linear regression is a regression model that estimates the relationship
between a quantitative dependent variable and two or more independent
variables using a straight line.
File , options, add-inns , manage go, analysis tool pack tick mark then ok then
data analytics will be added at top
X Y
1 2.94
2 5.41
3 7.12
4 9.08
5 11.32
6 13.56
Go to data then data analytics then select regression press Ok
Tick labels, select new worksheet ply press OK then the below results come
SUMMARY
OUTPUT
Regression Statistics
Multiple R 0.998967914
R Square 0.997936893
Adjusted R Square 0.997421116
Standard Error 0.197788969
Observations 6
ANOVA
Significance
df SS MS F F
Regression 1 75.69120143 75.69120143 1934.823111 1.59725E-06
Residual 4 0.156481905 0.039120476
Total 5 75.84768333
Standard
Coefficients Error t Stat P-value Lower 95% Upper 95% L
Intercept 0.959333333 0.184131509 5.210044371 0.006471426 0.448102306 1.470564361 0
X 2.079714286 0.047280607 43.98662422 1.59725E-06 1.948442276 2.210986295 1
Regression Statistics
Multiple R 0.3175
R Square 0.1008
Adjusted R Square -0.5736
Standard Error 10.3960
Observations 8
ANOVA
Significance
df SS MS F F
Regression 3 48.47489 16.1583 0.149509 0.924804
Residual 4 432.3039 108.076
Total 7 480.7788
X Y
1 0.0
2 0.8
3 -10.2
4 -31.8
5 -55.6
6 -66.0
7 -40.2
8 51.8
9 247.2
10 590.4
Fit a polynomial of degree 4 to the 5 points. In general, for n points, you can fit
a polynomial of degree n-1 to exactly pass through the points.
Go to insert command then scatter then scatter with only markers graph displays
Right click on the any scatter point of graph add TREADLINE then select
POLYNOMIAL select degree 4 then put right mark on display equation on
chart
700.0
600.0
500.0
y = 0.3x4 - 2.8x3 + 3.4x2 + 5.7x - 6.6
400.0
Series1
300.0
Poly. (Series1)
200.0
100.0
0.0
0 2 4 6 8 10 12
-100.0
Note: C3:C12 means select all Y values B3:B12 means select all X values
Then select adjacent four cells of 0.3 Press f2 simultaneously press control+shift
and enter displays
Residuals Plot: A residual plot is a type of plot that displays the fitted
values against the residual values for a regression model.
1 Residual Plot
400
Residuals
200
0
0 2 4 6 8 10 12
-200
1
1 70
2 60
3 50
4 40
5 30
6 20
7 10
8 5
9 3
10 2
select all X & Y values, go to Insert then go scatter and select scatter with
straight line markers, the below graph displays
Then on straight line click right button of mouse, go to add Trend line, select
Linear then select display equation on chart then below graph displays.
80
70
60 y = -8.097x + 73.533
50
40 Series1
30
20 Linear (Series1)
10
0
-10 0 5 10 15
-20
Random 1 random 2
10 16
20 22
30 55
40 66
50 78
Go to data analysis then select moving average press ok select for input
range select second row values only 16 to 78 select output range any cell
tick chart output press ok graph displays as below
Moving Average
100
Value
50
Actual
0 Forecast
1 2 3 4 5
Data Point