Using The Vlookup Function To Design Workers Payroll System In Excel

The VLOOKUP function is similar to the LOOKUP function. The V in VLOOKUP stands for vertical. Like the LOOKUP function, the whole data must be sorted first before Excel can return a result. VLOOKUP function is used to search a specified range of column(s) of a spreadsheet for a value. If the value is found, Excel can now return data from another cell in the same row with the lookup value.
Using The Vlookup Function To Design Workers Payroll System In Excel

The syntax for the VLOOKUP function is:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

You need to first read: LOOKUP FUNCTION AND REFERENCING DATA IN OTHER WORKSHEETS OF AN EXCEL WORKBOOKAlso see the full tutorial course content of this Microsoft Excel Tutorial Series



The function takes four arguments:
1. lookup_value (required): This is the value to search in the first column of the table or range. The lookup_value argument can be a value or a reference. If the value you supply for the lookup_value argument is smaller than the smallest value in the first column of the table_array argument, VLOOKUP returns the #N/A error value. 

2. table_array (required): This is the range of cells that contains the data. You can use a reference to a range (for example, A2:D8), or a range name. The values in the first column of table_array are the values searched by lookup_value. These values can be text, numbers, or logical values. Uppercase and lowercase text are equivalent. 


3. col_index_num (required): This is the column number in the table_array argument from which the matching value must be returned. A col_index_num argument of 1 returns the value in the first column in table_array; a col_index_num of 2 returns the value in the second column in table_array, and so on. 


If the col_index_num argument is:
Less than 1, VLOOKUP returns the #VALUE! error value. 
Greater than the number of columns in table_array, VLOOKUP returns the #REF! error value.

4. range_lookup (optional): This is the fourth argument and it is optional. A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match:


If range_lookup is either TRUE or is omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned.

If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value.

If range_lookup is FALSE, the values in the first column of table_array do not need to be sorted.

If the range_lookup argument is FALSE, VLOOKUP will find only an exact match. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned. 

NOTES:

When searching text values in the first column of table_array, ensure that the data in the first column of table_array does not contain leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and curly ( ‘ or “) quotation marks, or non printing characters. In these cases, VLOOKUP might return an incorrect or unexpected value. 

When searching number or date values, ensure that the data in the first column of table_array is not stored as text values. In this case, VLOOKUP might return an incorrect or unexpected value. 


If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters — the question mark (?) and asterisk (*) — in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character. 



For example, using the same worksheet I used to illustrate the LOOKUP function, to find a worker with ID equal to JS001, enter the following formula in cell B10:
=VLOOKUP(A3, A3:B7, 2, FALSE) and press Enter.

The function should return JOHN, the name that matches the ID, JS001.

ILUSTRATION: PERFORMING CALCULATIONS USING VLOOKUP FUNCTION

DESIGNING A PAYROLL SYSTEM USING VLOOKUP FUNCTION

You can also use the LOOKUP function to perform some calculations. For example:

QUESTION:

Using the information contained in the worksheet shown in the figure below, design a payroll system containing the workers’ details and a pay slip in the same worksheet. Also calculate the New Salary inside the pay slip.
Payroll System Using VLOOKUP function
Payroll System Using VLOOKUP function

SOLUTION TO THE ABOVE PAYROLL SYSTEM EXERCISE

1. Prepare your worksheet as shown in the figure below.
Layout of Payroll system using VLOOKUP function
Layout of Payroll system using VLOOKUP function
2. Type in the following formula in cell A13 (the yellow cell):
=CONCATENATE(VLOOKUP(C9,A3:E7,2,FALSE)," ",VLOOKUP(C9,A3:E7,3,FALSE)) and press Enter.

The CONCATENATE function above has 3 arguments: 
The first argument is generated by the VLOOKUP function nested in the CONCATENATE and it returns the surname of the worker whose ID is equal to the value entered in cell C9.

The second argument returns a space.

The third argument returns the last name of the worker whose ID is equal to the value entered in cell B9.

The Three returned argument combined together gives the full name of the worker whose ID is entered in cell C9.

3. Type in the following formula in cell C13 (under the FULL NAME column):
=VLOOKUP(C9,A3:E7,4,FALSE)+VLOOKUP(C9,A3:E7,5,FALSE) and press Enter.

The first VLOOKUP function in the formula above returns the salary of the worker whose ID is entered in cell C9.

The second VLOOKUP function returns the value of the 10% salary increment of the same worker.

The sum of the value returned by both function gives the new salary of the worker.
Now let me test your knowledge.

EXERCISE UNDER VLOOKUP FUNCTION

Now repeat the last illustration above, but this time use a separate worksheets of a workbook to prepare workers details table and the pay slip table of the payroll system using the same procedure shown above.
Calculate the New Salary inside the pay slip table.

HINTS:

Rename the first worksheet to WORKERS_DETAILS and the second worksheet to PAY_SLIP.
Remember to use absolute cell references as shown previously.

Congrats! You have completed the part 3 of this Excel tutorial. 

You now have to go to Chapter 4 (Store Ledger Accounting in MS Excel).

Don't forget to subscribe for free to get my Tutorial updates delivered to your email. Press a SHARE button to help your friends who may need this tutorial.

Comment your questions in the comment box below.

No comments:

Post a Comment

WHAT'S ON YOUR MIND?
WE LOVE TO HEAR FROM YOU!