SlideShare a Scribd company logo
1 of 6
Nested Functions

How do we evaluate a complex
formula?
What are DeMorgan’s Laws?

CS 105 Spring 2011

#1
Grade Example
• Suppose there is
2% extra credit
(column AK)
• Solution 1: create
column AN for
“Points + EC”

Y

Y

=IF(AK2=“Y”,AI2*102%,AI2)

Then use
• Solution 2:

=VLOOKUP(AN2,AL2:AM12,TRUE)

Y

=VLOOKUP( IF(AK2=“Y”,AI2*102%,AI2) ,AL2:AM12,TRUE)

CS 105 Spring 2011

#2
Nested Functions
• In order to evaluate a complex formula like
=VLOOKUP(IF(AK2=“Y”,AI2*102%,AI2),AL2:AM12,TRUE)

start by evaluating the inner parts
• The overall formula can be evaluated once the
values of the inner sub-expressions are known

• A more complex example:
IF(ISERROR(VLOOKUP(value,range,col)),”No”,”Yes”)
3

2

1

CS 105 Spring 2011

#3
DeMorgan’s Laws
• Consider the following formulas:
a) NOT(AND(X, Y))
b) AND(NOT(X), NOT(Y))
c) NOT(OR(X, Y))
d) OR(NOT(X), NOT(Y))
• The formulas (a) and (d) are equivalent, and so are
formulas (b) and (c)
• We can verify this with truth tables:
X

Y

AND(X,Y)

NOT(AND(X,Y))

NOT(X)

NOT(Y)

OR(NOT(X), NOT(Y))

0

0

0

1

1

1

1

0

1

0

1

1

0

1

1

0

0

1

0

1

1

1

1

1

0

0

0

0

CS 105 Spring 2011

#4
Example: College Admissions
• A college grants admissions based on three criteria:
SAT score (S), Letter score (L), and References (R)
S

L

R

Decision

1300

AND

8.5

AND

8.25

Strong accept

1200

AND

8.0

AND

7.80

Accept

1200

OR

7.5

OR

7.00

Reject

…

Manual

…

ELSE

• Which of these formulas is correct?
IF(AND(S>=1300,L>=8.5,R>=8.25),
"Strong accept",
IF(AND(S>=1200, L>=8, R>=7.8),
"Accept",
IF(OR(S<1200, L<7.5, R<7),
"Reject", "Manual")))

IF(OR(S<1200,L<7.5,R<7),
"Reject",
IF(OR(L<8,R<7.8),"Manual",
IF(OR(S<1300,L<8.5,R<8.25),
"Accept",
"Strong accept")))

CS 105 Spring 2011

#5
Testing Your Knowledge

• How do we evaluate a complex
formula?
• What are DeMorgan’s Laws?

CS 105 Spring 2011

#6

More Related Content

Viewers also liked (10)

Serbian football in 1930
Serbian football in 1930Serbian football in 1930
Serbian football in 1930
 
01
0101
01
 
CWTS
CWTSCWTS
CWTS
 
Forecasting the future
Forecasting the futureForecasting the future
Forecasting the future
 
excel ppt
excel pptexcel ppt
excel ppt
 
Space
SpaceSpace
Space
 
IMAGING OF INTRACRANIAL PRIMARY NON-NEOPLASTIC CYSTS
IMAGING OF INTRACRANIAL PRIMARY NON-NEOPLASTIC CYSTSIMAGING OF INTRACRANIAL PRIMARY NON-NEOPLASTIC CYSTS
IMAGING OF INTRACRANIAL PRIMARY NON-NEOPLASTIC CYSTS
 
Testicular Torsion
Testicular TorsionTesticular Torsion
Testicular Torsion
 
CYSTIC FIBROSIS
CYSTIC FIBROSISCYSTIC FIBROSIS
CYSTIC FIBROSIS
 
Applicationofstack by Ali F.RAshid
Applicationofstack  by Ali F.RAshid Applicationofstack  by Ali F.RAshid
Applicationofstack by Ali F.RAshid
 

Similar to 06 excel4

270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
eugeniadean34240
 
Matrix chain multiplication in design analysis of algorithm
Matrix chain multiplication in design analysis of algorithmMatrix chain multiplication in design analysis of algorithm
Matrix chain multiplication in design analysis of algorithm
RajKumar323561
 
Algorithm1 course 1st slide
Algorithm1 course 1st slideAlgorithm1 course 1st slide
Algorithm1 course 1st slide
Hani Ghazi
 
Chapter4.2
Chapter4.2Chapter4.2
Chapter4.2
nglaze10
 
Lect06 handout
Lect06 handoutLect06 handout
Lect06 handout
nomio0703
 

Similar to 06 excel4 (20)

DynamicProgramming.ppt
DynamicProgramming.pptDynamicProgramming.ppt
DynamicProgramming.ppt
 
DynamicProgramming.pdf
DynamicProgramming.pdfDynamicProgramming.pdf
DynamicProgramming.pdf
 
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Exponentials
ExponentialsExponentials
Exponentials
 
Matrix chain multiplication in design analysis of algorithm
Matrix chain multiplication in design analysis of algorithmMatrix chain multiplication in design analysis of algorithm
Matrix chain multiplication in design analysis of algorithm
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 
Algorithm1 course 1st slide
Algorithm1 course 1st slideAlgorithm1 course 1st slide
Algorithm1 course 1st slide
 
DSM.pptx
DSM.pptxDSM.pptx
DSM.pptx
 
Chapter4.2
Chapter4.2Chapter4.2
Chapter4.2
 
P7
P7P7
P7
 
Lecture -16-merge sort (slides).pptx
Lecture -16-merge sort (slides).pptxLecture -16-merge sort (slides).pptx
Lecture -16-merge sort (slides).pptx
 
Engineering Equation Solver (Thai)
Engineering Equation Solver (Thai)Engineering Equation Solver (Thai)
Engineering Equation Solver (Thai)
 
102_2_digitalSystem_Chap_2_part_1.ppt
102_2_digitalSystem_Chap_2_part_1.ppt102_2_digitalSystem_Chap_2_part_1.ppt
102_2_digitalSystem_Chap_2_part_1.ppt
 
Ch35 ssm
Ch35 ssmCh35 ssm
Ch35 ssm
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
4.2 exponential function and compound interest
4.2 exponential function and compound interest4.2 exponential function and compound interest
4.2 exponential function and compound interest
 
SHS MATH QUIZ
SHS MATH QUIZSHS MATH QUIZ
SHS MATH QUIZ
 
CLASS NOTES FOR SUBJECT ELECTRONICS.pptx
CLASS NOTES FOR SUBJECT ELECTRONICS.pptxCLASS NOTES FOR SUBJECT ELECTRONICS.pptx
CLASS NOTES FOR SUBJECT ELECTRONICS.pptx
 
Lect06 handout
Lect06 handoutLect06 handout
Lect06 handout
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

06 excel4

  • 1. Nested Functions How do we evaluate a complex formula? What are DeMorgan’s Laws? CS 105 Spring 2011 #1
  • 2. Grade Example • Suppose there is 2% extra credit (column AK) • Solution 1: create column AN for “Points + EC” Y Y =IF(AK2=“Y”,AI2*102%,AI2) Then use • Solution 2: =VLOOKUP(AN2,AL2:AM12,TRUE) Y =VLOOKUP( IF(AK2=“Y”,AI2*102%,AI2) ,AL2:AM12,TRUE) CS 105 Spring 2011 #2
  • 3. Nested Functions • In order to evaluate a complex formula like =VLOOKUP(IF(AK2=“Y”,AI2*102%,AI2),AL2:AM12,TRUE) start by evaluating the inner parts • The overall formula can be evaluated once the values of the inner sub-expressions are known • A more complex example: IF(ISERROR(VLOOKUP(value,range,col)),”No”,”Yes”) 3 2 1 CS 105 Spring 2011 #3
  • 4. DeMorgan’s Laws • Consider the following formulas: a) NOT(AND(X, Y)) b) AND(NOT(X), NOT(Y)) c) NOT(OR(X, Y)) d) OR(NOT(X), NOT(Y)) • The formulas (a) and (d) are equivalent, and so are formulas (b) and (c) • We can verify this with truth tables: X Y AND(X,Y) NOT(AND(X,Y)) NOT(X) NOT(Y) OR(NOT(X), NOT(Y)) 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 0 0 0 CS 105 Spring 2011 #4
  • 5. Example: College Admissions • A college grants admissions based on three criteria: SAT score (S), Letter score (L), and References (R) S L R Decision 1300 AND 8.5 AND 8.25 Strong accept 1200 AND 8.0 AND 7.80 Accept 1200 OR 7.5 OR 7.00 Reject … Manual … ELSE • Which of these formulas is correct? IF(AND(S>=1300,L>=8.5,R>=8.25), "Strong accept", IF(AND(S>=1200, L>=8, R>=7.8), "Accept", IF(OR(S<1200, L<7.5, R<7), "Reject", "Manual"))) IF(OR(S<1200,L<7.5,R<7), "Reject", IF(OR(L<8,R<7.8),"Manual", IF(OR(S<1300,L<8.5,R<8.25), "Accept", "Strong accept"))) CS 105 Spring 2011 #5
  • 6. Testing Your Knowledge • How do we evaluate a complex formula? • What are DeMorgan’s Laws? CS 105 Spring 2011 #6