You are on page 1of 14

Filters - FILTER, DATEVALUE, MEDIAN

เรากำลังหา Median จากเงื่อนไขกับข้อมูลภายใน range


อย่างไรก็ตาม Excel ไม่ได้มี Function MEDIANIF ดังนั้นเราจะต้องคำนวณหาจ
เราจะใช้ฟังก์ชั่น filter
เราจะใช้ตัวกรอง filter กับข้อมูลใน range โดยการกำหนด condition แล้วข้อมู
FILTER(range, condition1, [condition2, ...]): evaluates to a filtered version o
condition1 here is substantially different from the criterion argument you'r
condition1 is not a string, but rather a range of logical values, for example A
For example, if we wanted to calculate the average amount spent on dinne
we could use the following formula: =AVERAGE(FILTER(D3:D26, E3:E26 = "D
Here, we filter the range of amount spent (D3:D26) based on whether the r
We then take the average of this filtered range.

DATEVALUE(date_string): evaluates to the date object of a date_string

เรามีข้อมูล Text 1900-01-01 ลองแปลงเป็ น date_string ด้วย

Day From Amount For Person


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
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
7/17/2017 Anneli 21.86 Drinks First half
8/5/2017 Anneli 13.26 Drinks Second half
8/8/2017 Dorotea 23.29 Dinner
8/31/2017 Arun 9.68 Drinks
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

สามารถ Sort ข้อมูล


11/27/2017 Dylan 17.27 Drinks จากเก่าไปใหม่ได้
Day
1/5/2017
3/9/2017
3/10/2017
3/11/2017
4/3/2017
4/25/2017
4/28/2017
5/12/2017
5/12/2017
5/30/2017
6/2/2017
7/17/2017
8/5/2017
8/8/2017
8/31/2017
9/4/2017
9/8/2017
9/14/2017
9/19/2017
10/14/2017
10/20/2017
11/4/2017
11/26/2017
11/27/2017
range
งนั้นเราจะต้องคำนวณหาจากวิธีการคำนวณทั่วๆไป ที่เราเคยเรียนรู้มาก่อน

กำหนด condition แล้วข้อมูลที่ผ่านเงื่อนไขก็จะแสดงออกมา


uates to a filtered version of range, based on the passed conditions.
e criterion argument you're used to.
gical values, for example A1:A5 > 5.
ge amount spent on dinners,
ILTER(D3:D26, E3:E26 = "Dinner")).
26) based on whether the range E3:E26 contains the word "Dinner".

ject of a date_string
Filter เป็ นฟังก์ชันที่มีอยู่ใน MS office 365
Amount
_string ด้วย DATEVALUE() Manual Input Filter #NAME?
Reference Input #NAME?
#NAME?
#NAME?
#NAME?
Times Sum Average Medium #NAME?
#NAME?
#NAME?

medium 15.5

Times Sum Average

Average Median
=MEDIAN
From Amount For
Anneli 13.01 Dinner
Dorotea 19.46 Gas
Dylan 13.19 Gas
Arun 15.06 Gas
Dylan 16.69 Dinner
Arun 23.88 Dinner
Anneli 9.95 Drinks
Dylan 20.45 Drinks
Anneli 9.34 Gas
Dylan 8.81 Drinks
Anneli 19.94 Dinner
Anneli 21.86 Drinks
Anneli 13.26 Drinks
Dorotea 23.29 Dinner
Arun 9.68 Drinks
Arun 10.56 Gas
Arun 11.68 Dinner
Arun 8.42 Gas
Dorotea 24.19 Dinner
Dorotea 5.11 Drinks
Anneli 17.74 Drinks
Arun 10.41 Dinner
Anneli 18.11 Dinner
Dylan 17.27 Drinks
นที่มีอยู่ใน MS office 365 ไม่มีบน desktop

=FILTER(D33:D56,C33:C56="Anneli")
ใน Sheet นี้ เราจะเรียนรู้แนวคิดเกี่ยวกับ "lookup" ใน Spread Sheet ซึ่งแนวคิดนี้เหมือนกันกับวิธีการที่เรา

เรากำลังกรอกเกรดให้กับนักศึกษาแต่ละคนในรายวิชานี้

เรามี 3 ตารางสำหรับพิจารณาเกรด

ตารางที่ 1 ตาราง grade จริง อยู่บนสุด มีข้อมูล GPA และ มีบาง cell ในบาง column ที่เป็ น cell ว่าง ที่เรา

ตารางที่ 2 ตารางหน่วยกิตของแต่ละวิชาไว้เป็ นข้อมูลในการกรอกหน่วยกิตในตาราง grade จริง

ตารางที่ 3 ตาราง "lookup table" หรือ ตารางลุคอัพ สำหรับพิจารณากรอกเกรด A B C D E F

ตารางที่ 1 Class Code (1) Credits แบบ Manual Score


Algebra MA101 3 3.6
Calculus MC101 3 3.1
Linear Algebra MA102 4 3.2
Introduction to
Programming CP101 6 2.8
Operating Systems CS102 6 3.7
Computer Architecture CS101 1 3
Logic ML101 3 2.4
Statistics MS101 3 2.6
Total

ตารางที่ 2 Code Credits Class


MA101 3 Algebra
MG101 3 Geometry
MC101 3 Calculus
MA102 4 Linear Algebra
MN102 5 Numerical Analysis
Introduction to
CP101 6 Programming
CS102 6 Operating Systems
CS101 4 Computer Architecture
CA101 4 Artificial Intelligence
ML101 3 Logic
MS105 6 Stochastic Models
MS101 3 Statistics
ตารางที่ 3 GPA 0 0.33 0.67
Grade F E D
et ซึ่งแนวคิดนี้เหมือนกันกับวิธีการที่เราค้นหาเบอร์โทรศัพท์ในสมุดโน๊ต

ell ในบาง column ที่เป็ น cell ว่าง ที่เราจำเป็ นต้องกรอกหน่วยกิต (Credit) เอง

หน่วยกิตในตาราง grade จริง

ณากรอกเกรด A B C D E F

Automating the look-Vloo


(2) Grade แบบ (3) Credits แบบ
Manual ตารางที่ 4 (4) Class Code Lookup
B Algebra MA101 3
B Calculus MC101 3
B Linear Algebra MA102 4
Introduction to
B Programming CP101 6
A Operating Systems CS102 6
B Computer Architecture CS101 4
C Logic ML101 3
C Statistics MS101 3
Total 32

เทอมนี้ลงทะเบียน
เติมชื่อวิชาจากข้อ (3) กี่หน่วย
(6) Total Credits
1.67 2.67 3.67
C B A
Automating the look-VlookUp
Course
Score (5) Grade แบบ Lookup (Credit * Score)
3.6 B 10.8
3.1 B 9.3
3.2 B 12.8

2.8 B 16.8
3.7 A 22.2
3 B 12
2.4 C 7.2
2.6 C 7.8
24.4 98.9

เทอมนี้ได้คะแนน
รวมเท่าไหร่ ผลรวมของผลคูณ (Credit * Score)
(7) Total Scores (8) Total (Credit * Score)

(9) Sumproduct() 98.9

(10) Total (Credit * Score) / Total Credits 3.090625

(11) Finally Grade = HLOOKUP((10)) B


Introducing VLOOKUP:
VLOOKUP(search_key, range, index, is_sorted): look for a match in the leftmost column of a lookup table
in a certain column:
search_key: the value to search for
range: the lookup table, without the headers. You typically use an absolute reference for this.
index: the column number of the value to be returned, where the first column in range is numbered 1
is_sorted: should be FALSE for now
You can compare it to the process of looking through a phone book.

The search_key would be the name of the person you want the phone number of.

The range is the data in the book, with the names in the leftmost column.

Finally, the index is the number of the column where you find what you need, the phone number.

Hint: = VLOOKUP(Code, ตารางที่ 2 , หมายเลขลำดับ column, FALSE)

Horizontal lookup - HLOOKUP


Although way less common, it can be useful to do a lookup through horizontally organized data. Introduci

HLOOKUP(search_key, range, index, is_sorted): similar to VLOOKUP but in a horizontal fashion.

The key will be looked for in the uppermost row, and index now refers to the row number.

You're now going to use the last argument, is_sorted. If set to TRUE (default), the function assumes that t
sorted.

When this is the case, the match doesn't have to be exact, but HLOOKUP will look for the closest match le
to search_key. If search_key is FALSE, an exact match is required.

For example, =HLOOKUP(0.78,S49:X50,2,TRUE) would evaluate to D in the given spreadsheet, as the close
equal to 0.78 is 0.57.
For example, =HLOOKUP(0.78,S49:X50,2,TRUE) would evaluate to D in the given spreadsheet, as the close
equal to 0.78 is 0.57.

ตัวอย่าง GPA 0 0.33 0.57 1.67 2.67 3.67


Grade F E D C B A

GPA 0.78
Grade D

Weighted average - SUMPRODUCT, HLOOKUP

In this last exercise, you'll calculate an average GPA and grade. To do so, the following function might c

SUMPRODUCT(array1, [array2, ...]): figure out the sum of products of 2 or more ranges of equal size.

E.g. SUMPRODUCT(A1:A3, B1:B3) evaluates to the result of (A1 * B1) + (A2 * B2 )+ (A3 * B3).

In mathematics, this operation is called the dot product.

In addition, you will again need to use HLOOKUP to calculate your grade:

HLOOKUP(search_key, range, index, is_sorted)


leftmost column of a lookup table and return the value

lute reference for this.


olumn in range is numbered 1

number of.

n.

need, the phone number.

zontally organized data. Introducing HLOOKUP:

t in a horizontal fashion.

o the row number.

ault), the function assumes that the values in range are

P will look for the closest match less than or equal

he given spreadsheet, as the closest match less than or


he given spreadsheet, as the closest match less than or

so, the following function might come in handy:

of 2 or more ranges of equal size.

+ (A2 * B2 )+ (A3 * B3).

ade:

You might also like