Professional Documents
Culture Documents
คพ341-65 Week08 Lab04 Conditional Function in SpreadSheet
คพ341-65 Week08 Lab04 Conditional Function in SpreadSheet
คุณต้องการเริ่มติดตามประสิทธิภาพของพนักงานของคุณและตัดสินใจติ
คุณสามารถดูตัวอย่างแผ่นงานของตัวชี้วัดประสิทธิภาพสำหรับพนักงาน
ตารางประสิทธิภาพการทำงาน
กรอกข้อมูลตามคำสั่ง
Employee Information
First กรอกชื่อจริง *Eng.)
Middle กรอกชื่อเล่น (Eng.)
Name
Last กรอกนามสกุล (Eng.)
กรอกที่อยู่ปัจุบัน
Number (Eng.)
Address Street มั่วๆได้
City
Country
กรอกค่าจ้าง พนักงานได้ค่าจ้าง 40
Hourly Rate ($) เป็ น currency USD. / ชม
Wage
ประสิทธิภาพการ
Weekend กรอกเป็ น ทำงานในสัปดาห์นั้น
multiplier (%) percentage ปกติ คือ 200%
bad
จงคำนวณหา Output
ของพนักงาน
value * finished
Output ($) Cost ($) Net ($) Performance
0 0
หาผลรวมของ output
ของพนักงานในเดือนนี้
คม 2018
ภัณฑ์และ
Finished: จำนวนของสินค้าที่ทำสำเร็จในวันนั้น
Output: มูลค่ารวมของสินค้าที่ทำสำเร็จทั้งหมดของพนักงานในวันนั้น (Value * Fin
Cost: ต้นทุนในการผลิตสินค้าเหล่านั้นในวันนั้น
Net: ความแตกต่างระหว่างมูลค่ากับต้นทุน
Performance: คุณภาพผลงานของพนักงานคนนั้นในวันนั้น (good, acceptable, ba
นในวันนั้น (Value * Finished)
ข้อมูล กฏกำหนดให้
A= 30 ถ้า A มากกว่า B ตอบ Yes
B= 40 ในทางตรงข้ามตอบ No
Employee Information
First 0
Name Middle 0
Last 0
Number 0
Street 0
Address
City 0
Country 0
กรอกค่าจ้างเป็ น
Hourly Rate ($) currency
Wage
Weekend กรอกเป็ น
multiplier (%) percentage
คำตอบ
Product Information
Code XL_4digit_StudentID
Cost ($) $ 20.00
Value ($) $ 50.00
Performance
good
acceptable
bad
ข้อมูล กฏกำหนดให้
A= 30 พิมพ์ข้อมูลที่มีค่ามากที่สุด
B= 40
C= 50
เรามาช่วยกันหาประสิทธิภาพการทำงานของเราในแต่ละวันจาก กฏดังต่อไปนี้
Employee Information
First 0
Name Middle 0
Last 0
Number 0
Street 0
Address
City 0
Country 0
กรอกค่าจ้างเป็ น
Hourly Rate ($) currency
Wage
Weekend กรอกเป็ น
multiplier (%) percentage
Day Weekend Hours Finished Output ($) Cost ($)
1/1/2018 0 9 12 $600 $600
1/2/2018 0 8 17 $850 $660
1/3/2018 0 8 14 $700 $600
1/4/2018 0 8 17 $850 $660
1/5/2018 0 7 20 $1,000 $680
1/6/2018 1 2 4 $200 $240
1/7/2018 1 1 2 $100 $120
1/8/2018 0 7 10 $500 $480
1/9/2018 0 7 7 $350 $420
1/10/2018 0 8 9 $450 $500
1/11/2018 0 9 12 $600 $600
1/12/2018 0 8 14 $700 $600
1/13/2018 1 0 0 $0 $0
1/14/2018 1 2 4 $200 $240
1/15/2018 0 8 10 $500 $520
1/16/2018 0 7 15 $750 $580
1/17/2018 0 7 15 $750 $580
1/18/2018 0 9 25 $1,250 $860
1/19/2018 0 9 17 $850 $700
1/20/2018 1 1 1 $50 $100
1/21/2018 1 1 3 $150 $140
1/22/2018 0 7 19 $950 $660
1/23/2018 0 7 13 $650 $540
1/24/2018 0 7 11 $550 $500
1/25/2018 0 8 16 $800 $640
1/26/2018 0 7 16 $800 $600
1/27/2018 1 1 2 $100 $120
1/28/2018 1 0 0 $0 $0
1/29/2018 0 8 17 $850 $660
1/30/2018 0 8 11 $550 $540
1/31/2018 0 8 16 $800 $640
Total 187 349 $17,450 $14,780
IF ซ้อน IF
คำตอบ Hint
=IF(…., IF(….,"A", "C"), IF(…, "B", "C"))
=IF(C5>C6, IF(C5>C7,"A", "C"), IF(C6>C7, "B", "C"))
Product Information
Code XL_4digit_StudentID
Cost ($) $ 20.00
Value ($) $ 50.00
Performance
good
acceptable
bad
กำไรจากการผลิต
Output - Cost
Net ($) Performance Hint
IF(Net น้อยกว่า ___, ___, IF(Net น้อยกว่า ___, "acceptable", ___
, IF(C6>C7, "B", "C"))
น้อยกว่า ___, "acceptable", ___))
Combining logical values - OR, WEEKDAY
จากข้อที่ผ่านมา Column Weekend มีค่าเป็ น False หรือ True โดยเรากรอกแบบแมนนวล (hard code) ซึ่งมันลำบาก
เราสามารถทำให้ spreadsheet อัตโนมัติมากยิ่งขึ้นได้โดยใช้ formulas:
OR(logical_expression1, [logical_expression2, ...]): this is the logical operator that returns TRUE if one of the ex
are FALSE.
For example, we can determine whether a cell (e.g. A2) is equal to 21 or 22 by using the following formula: =OR
WEEKDAY(date, [type]): evaluates to the day of the week of a date. type is 1, 2 or 3.
type = 1: Sunday is day 1 and Saturday is day 7 (default)
type = 2: Monday is day 1 and Sunday is day 7
type = 3: Monday is day 0 and Sunday is day 6
To help get you started, a logical expression to test whether a date in cell B2 fell on a Monday could look like this
Employee Information
First 0
Name
Middle 0
Last 0
Number 0
Street 0
Address
City 0
Country 0
กรอกค่าจ้างเป็ น
Hourly Rate ($) currency
Wage
Weekend กรอกเป็ น
multiplier (%) percentage
แก้ไขให้เป็ น
(2) formula
Day Weekend Hours Finished Output ($) Total Cost ($)
1/1/2018 9 12 $ 600 #VALUE!
1/2/2018 8 17 $ 850 #VALUE!
1/3/2018 8 14 $ 700 #VALUE!
1/4/2018 8 17 $ 850 #VALUE!
1/5/2018 7 20 $ 1,000 #VALUE!
1/6/2018 2 4 $ 200 #VALUE!
1/7/2018 1 2 $ 100 #VALUE!
1/8/2018 7 10 $ 500 #VALUE!
1/9/2018 7 7 $ 350 #VALUE!
1/10/2018 8 9 $ 450 #VALUE!
1/11/2018 9 12 $ 600 #VALUE!
1/12/2018 8 14 $ 700 #VALUE!
1/13/2018 0 0 $ - #VALUE!
1/14/2018 2 4 $ 200 #VALUE!
1/15/2018 8 10 $ 500 #VALUE!
1/16/2018 7 15 $ 750 #VALUE!
1/17/2018 7 15 $ 750 #VALUE!
1/18/2018 9 25 $ 1,250 #VALUE!
1/19/2018 9 17 $ 850 #VALUE!
1/20/2018 1 1 $ 50 #VALUE!
1/21/2018 1 3 $ 150 #VALUE!
1/22/2018 7 19 $ 950 #VALUE!
1/23/2018 7 13 $ 650 #VALUE!
1/24/2018 7 11 $ 550 #VALUE!
1/25/2018 8 16 $ 800 #VALUE!
1/26/2018 7 16 $ 800 #VALUE!
1/27/2018 1 2 $ 100 #VALUE!
1/28/2018 0 0 $ - #VALUE!
1/29/2018 8 17 $ 850 #VALUE!
1/30/2018 8 11 $ 550 #VALUE!
1/31/2018 8 16 $ 800 #VALUE!
Total 187 349 $ 17,450 #VALUE!
บบแมนนวล (hard code) ซึ่งมันลำบากมากเวลามีข้อมูลใหม่
rator that returns TRUE if one of the expressions is TRUE and FALSE if and only if all of them
นักศึกษาคิดว่าทำไมถึงตอบเลขนี้
นักศึกษาคิดว่าทำไมถึงตอบเลขนี้
นักศึกษาคิดว่าทำไมถึงตอบเลขนี้
Performance
good
acceptable
bad
(3) (5)
Reference จาก
ข้อก่อนหน้านี้
Net ($) Performance
#VALUE!
Hint: เช็ค Column B ว่าเป็ นวัน Saturaday หรือ
#VALUE!
Sunday ด้วย OR(), Weekday()
#VALUE!
#VALUE! = OR(WEEKDAY(B___) = ___, ___(B__) = 7)
#VALUE!
#VALUE!
#VALUE! Hint --> =OR(WEEKDAY(B39) =1, WEEKDAY(B39)=7)
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
#VALUE!
Conditional counting - COUNTIF
เราต้องการนับจำนวนวันที่เราทำงานว่ามีประสิทธิภาพดีกี่วัน ยอมรับได้กี่วันและ ไม่ดีกี่วัน
เราสามารถนับความถี่ของข้อมูลข้อความได้ด้วย:
COUNTIF(range, criterion): count the number of times the criterion is met in the specified range.
range: the source data that is used. Typically, you'll need to use an absolute reference for this one.
criterion: a pattern to check for. It can be as simple as a string you want to match on.
For example: "good". You'll see more complex criterions in later exercises.
For example: if B14:A16 contains "good", "bad", "bad", then = COUNTIF(A14:A16, "bad") evaluates to 2.
(4) count
good good 1
bad bad
bad
KDAY(B39)=7)
ange.
s one.
aluates to 2.
Table A
Day From Amount For Person Times Sum
1/5/2017 Anneli 13.01 Dinner Anneli
3/9/2017 Dorotea 19.46 Gas Arun
3/10/2017 Dylan 13.19 Gas Dorotea
3/11/2017 Arun 15.06 Gas Dylan
4/3/2017 Dylan 16.69 Dinner
4/25/2017 Arun 23.88 Dinner For Times Sum
4/28/2017 Anneli 9.95 Drinks Dinner
5/12/2017 Dylan 20.45 Drinks Drinks
5/12/2017 Anneli 9.34 Gas Gas
5/30/2017 Dylan 8.81 Drinks
6/2/2017 Anneli 19.94 Dinner When Average
7/17/2017 Anneli 21.86 Drinks First half
Second
8/5/2017 Anneli 13.26 Drinks half
8/8/2017 Dorotea 23.29 Dinner
8/31/2017 Arun 9.68 Drinks * first half คือ วันที่อยู่ก่อน
9/4/2017 Arun 10.56 Gas
9/8/2017 Arun 11.68 Dinner
9/14/2017 Arun 8.42 Gas
9/19/2017 Dorotea 24.19 Dinner
10/14/2017 Dorotea 5.11 Drinks
10/20/2017 Anneli 17.74 Drinks
11/4/2017 Arun 10.41 Dinner
11/26/2017 Anneli 18.11 Dinner
11/27/2017 Dylan 17.27 Drinks
(1) นับความถี่ของแต่ละชื่อ (Person) ที่ปรากฏใน column From ของ Table A
Average
(2) นับความถี่ของแต่ละเหตุการณ์ (For) ที่ปรากกฏใน column From ของ Table A
For example
Arun 3 ผลรวมของ
1/7/2017 Dylan 4
Dylan 8
(5)
Advanced conditions - AVERAGEIF
Up until now, the condition was always an equality check on certain ranges. However, as specified
Equals: 1 or "= 1"
Greater than: "> 1"
Greater than or equal to: ">= 1"
Less than: "< 1"
Less than or equal to: "<= 1"
Not equal to: "<> 1"
Note that this is very similar to the comparison operators you saw earlier.
As a refresher, here's the signature of the AVERAGEIF function:
AVERAGEIF(range, criterion, average_range): evaluates to the conditional average across a range.
range: the range on which the criterion will be checked
criterion: the pattern that will be checked, e.g. "Dylan"
average_range: the range of values that will be summed up
Greater than or equal to: ">= 1"
Less than: "< 1"
Less than or equal to: "<= 1"
Not equal to: "<> 1"
Note that this is very similar to the comparison operators you saw earlier.
As a refresher, here's the signature of the AVERAGEIF function:
AVERAGEIF(range, criterion, average_range): evaluates to the conditional average across a range.
range: the range on which the criterion will be checked
criterion: the pattern that will be checked, e.g. "Dylan"
average_range: the range of values that will be summed up
For example
ss a range.
es is the average.
es. However, as specified in the documentation, the criterion argument can be a bit more advanced:
r.