代写ECON10151 Lecture 4 Managing Data with Excel Functions调试R语言程序

ECON10151 Lecture 4

Managing Data with Excel Functions

Oct 2024

Learning Outcomes

•  Be able to effectively retrieve data from a dataset using VLOOKUP, INDEX, and MATCH functions, and apply them to large datasets.

•  Understand the differences and use cases of VLOOKUP versus INDEX and MATCH, enabling them to choose the appropriate function based on specific data retrieval needs.

Introduction

Excel offers a wide range of powerful functions that can help you manage, analyse, and extract valuable insights from data. This week, we’ll focus on three key functions that are essential for working with data effec- tively: VLOOKUP, MATCH, and INDEX. These functions will enable you to quickly find specific information, locatedata within a table, and retrieve values from different parts of your dataset.

1   VLOOKUP

In this section, we will explore the syntax of VLOOKUP and will break down the arguments so that you can understand how they work.

1.1   VLOOKUP Syntax

The VLOOKUP function searches for a value in the first column of a table and returns a value in the same row from another column.

Syntax:

=VLOOKUP(lookup value,  table array,  col   index num,  [range lookup])

Arguments:

•  lookup value: The value you want to search for in the first column of the table.

• table array:  The range of cells that contains the data.  The first column of this range is where the lookup value will be searched.

•  col   index num: The column number (starting from 1) from which you want to retrieve the value.

•  [range lookup] : An optional argument. Use TRUE for an approximate match or FALSE for an exact match. FALSE is recommended for most cases to ensure accurate results.

1.2    Practice with VLOOKUP

Instructions

In this exercise, you will practice using the VLOOKUP function in Excel to retrieve specific data from a table. You will be working with a dataset that contains information about students, their departments, academic year, and GPA. Follow the tasks below to complete the exercise.

Dataset

The dataset contains the following columns:

  Student ID: Unique identifier for each student.

•  Name: Name of the student.

•  Department: The department the student belongs to.

 Year: The academic year of the student.

•  GPA: The students Grade Point Average.

Task 1: Find GPA for Given Students

You are provided with the names of two students:

 Alice Smith

•  George Patel

Your task is to use the VLOOKUP function to find their GPAs from the dataset. Follow these steps:

1.  Open Excel L4 Data and work on the worksheet named as VLOOKUP.

2.  In cells B15 and B16, use the VLOOKUP function to find the GPA for each of the two students.

3.  Syntax of VLOOKUP:

=VLOOKUP(lookup value,  table array,  col   index num,  [range lookup])

4.  Setup

•  lookup value: The value you want to search for in the first column of the table.

- Set it to the student’s name.

• table array: The range of cells that contains the data. The first column of this range is where the lookup value will be searched.

- Select the data range covering the columns from Student Name to GPA.

•  col   index num: The column number (starting from 1) from which you want to retrieve the value.

- It is the GPA column, which is the 4th column in the range.

•  range lookup: An optional argument. Use TRUE for an approximate match or FALSE for an exact match.

- We set it to FALSE to ensure an exact match is found.

Remember:  Make sure the lookup value is in the first column of the table array.  Therefore, when you select data for the table array, ensure that the student names are in the first column of this array.

The GPA for Alice Smith:     = VLOOKUP(A15,  $B$2:$E$11,  4,  FALSE)

The GPA for George Patel:     = VLOOKUP(A16,  $B$2:$E$11,  4,  FALSE)

5.  Graphical illustration of the formula:

 

Figure 1: Task 1 VLOOKUP Example

6.  Report the GPAs for Alice Smith and George Patel.  You should obtain the following results once you have entered the formula.

 

Figure 2: Task 1 Results

Task 2: Check if Student Name Exists in the Dataset

You are given the following names:

 Julia Fernandez

•  Michael Green

Your task is to use the VLOOKUP function to check if these names exist in the dataset. Follow these steps:

1. Think: How to use VLOOKUP

If the name exists, return the corresponding Name from the list.  If not, the function should return an error (such as #N/A).

2.  Syntax of VLOOKUP:

=VLOOKUP(lookup value,  table array,  col   index num,  FALSE)

3.  Setup

•  lookup value: The value you want to search for in the first column of the table.

- Set it to the student’s name.

• table array: The range of cells that contains the data. The first column of this range is where the lookup value will be searched.

- Define table array as the data range covering the single column of Student Name.

•  col   index num: The column number (starting from 1) from which you want to retrieve the value.

- Assign col   index num to the first column, which is the only column in the range.

•  range lookup: An optional argument. Use TRUE for an approximate match or FALSE for an exact match.

- Set range lookup to FALSE to ensure that an exact match is found.

Remember:  Make sure the lookup value is in the first column of the table array.  Therefore, when you select data for the table array, ensure that the student names are in the first column of this array.

Julia Fernandez:     = VLOOKUP(A20,$B$2:$B$11,1,FALSE)

Michael Green:     = VLOOKUP(A21,$B$2:$B$11,1,FALSE)

4.  Graphical illustration of the formula:

 

Figure 3: Task 2 VLOOKUP Example

5.  Report whether each of the two names is found in the dataset.  You should obtain the following results once you have entered the formula.

 

Figure 4: Task 2 Results

This suggests that Julia Fernandez is included in the dataset; however, Michael Green is not on the list, as it returns an error (#N/A )in the cell.

2   INDEX and MATCH

In this section, we will briefly explore the syntax of the INDEX and MATCH functions. The INDEX function returns a value based on specified row and column numbers within a given array, while the MATCH function finds the position of a value in a row or column.

We will break down their arguments to help you understand how each function works.

INDEX

The INDEX function returns the value in a specified cell.  You need to know the row and column numbers of the cell within an array so that Excel can locate its position.  Once identified, the function returns the value contained in that cell.

Syntax:

=INDEX(array,  row num,  [column num])

Arguments:

•  array: The range of cells that contains the data from which you want to retrieve a value.

•  row num: The row number in the array from which you want to retrieve a value.

•  [column num] : The optional column number in the array. If omitted, the function will return the value from the first column.

MATCH

The MATCH function searches for a specified value in a specific column or a row and returns the relative position of that value.

Syntax:

=MATCH(lookup value,  lookup array,  [match type])

Arguments:

•  lookup value: The value you want to search for in the array.

•  lookup array: The range of cells that contains the data you want to search.  The lookup array here can only be a single column or a single row.

•  [match type] : An optional argument.  It specifies how Excel should match the lookup value.  Use 1 for the largest valueless than or equal to the lookup value, 0 for an exact match, or -1 for the smallest value greater than or equal to the lookup value. For most scenarios, 0 is preferred to ensure an exact match.


2.1    Practice with INDEX and MATCH

Task 1: Obtain the GPA of the Student with ID 33104 Using INDEX and MATCH

Manually finding a student’s GPA would involve identifying the correct row where the Student ID appears and then locating the GPA in the corresponding column. For small datasets, this is simple, but as datasets grow larger, manually finding this information becomes prone to error and time-consuming. With Excel’s INDEX and MATCH functions, we can automate this task and ensure accuracy. Thus, in this task, we can use MATCH to find out the row number and the column number.  Then, INDEX can return the value of GPA based on the row number of Student ID and the column number of GPA.

Your objective is to find the GPA of the student with the Student ID: 33104.  To achieve this goal, we can follow these steps:

1.  Use the MATCH function to find the row number where the Student ID 33104 is located.

•  (Worksheet: MATCH and INDEX) Begin with the cell I7 and type MATCH formula in the cell.

•  Syntax of MATCH:

=MATCH(lookup value,  lookup array,  [match type]).

  Setup

。lookup value: The value you want to search for in the array.

- This case, it is 33104 (the Student ID you’re looking for).

。lookup array: The range of cells that contains the data you want to search. The lookup array here can only be a single column or a single row.

- We select the column of Student IDs (column A in the dataset).

。 [match type] should be set to 0 for an exact match.

The row number of Student ID 33104:

= MATCH(H7,  A2:A11,  0)

  Graphical illustration of the formula:

 

 

Figure 5: Task 1 MATCH Example: row no.

 

2.  Use the MATCH function to find the column number where the GPA is located.

•  Begin with the cell I11 and type MATCH formula in the cell.

•  Syntax of MATCH:

 

=MATCH(lookup value,  lookup array,  [match type]).

  Setup



。lookup value: The value you want to search for in the array.

- It is GPA (the header you are looking for in the row, including all headers).

。lookup array: The range of cells that contains the data you want to search. The lookup array here can only be a single column or a single row.

- We select the row of headers (Row 1 in the dataset). 。 [match type] should be set to 0 for an exact match.

The column number of GPA:

= MATCH(H11,A1:E1,0)

  Graphical illustration of the formula

 

Figure 6: Task 1 MATCH Example: column no.

3.  Use the INDEX function to return the GPA of the student with ID 33104

We can fill in the INDEX function based on the row number and the column number found using the MATCH function.

•  Begin with the cell I17 and type INDEX formula in the cell.

•  Syntax of INDEX: =INDEX(array,  row num,   [column num])

  Setup

。array contains all of the values in this student information data set. 。row num corresponds to the row number of the student ID 33104.

。col num corresponds to the column number where GPA is located.

The GPA of the student with ID 33104:

= INDEX(A1:E11,I7,I11)

  Graphical illustration of the formula:

 

Figure 7: Task1 INDEX Example


热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图