Lab 2
Lab 2
md 1/18/2023
Notice that in both cases the reference is down two cells and one to the right.
Absolute references do not adjust when the cell is copied, they always reference the same cell in the
workbook. The dollar sign notation is use to designate absolute references, for example $B$2.
Extra documentation on absolute and relative references can be found here.
1/7
Lab2.md 1/18/2023
SUMIF Function
The SUMIF function only includes values in the sum if some criteria is met. The function takes three
arguments:
The range to compare against.
The condition to evaluate.
The range to actually sum values from.
In the following example only values in column B with an "a" in column A are considered in the sum.
2/7
Lab2.md 1/18/2023
Extra documentation and a video tutorial for the VLOOKUP function can be found here.
IF Function
The IF function allows you to make a binary decision (two outcomes) based on the value in another cell.
The function takes three arguments:
A conditional expression (can be true or false).
A value for if the condition is true.
A value for if the condition is false.
Consider the example below where the numerical value in column A was used to determine the value that
gets placed in column B.
3/7
Lab2.md 1/18/2023
Every client should have a unique Client Id. Recall from lab 1 that your workbook should have minimum 4
clients.
Note: These are both coloured blue to indicate they are input fields.
2) Create Project Sheet
Create a sheet to track projects and relate them to clients (in the client sheet). Name the sheet
project.
Recall from lab 01 that your workbook should have minimum 4 projects. Enter your data into the input
cells. Do not enter anything into the auto-populated cells yet. They will be filled in the later steps. Once you
have entered the input data, proceed to the next steps.
2.2) Link Projects to Clients
Use the VLOOKUP function to have the Client Name field auto populate based on the Client Id that is
entered. The formula will look into the client sheet and based on the cliend ID entered in the project sheet, it
will populate the correct client name in the project sheet. For example, given the sample data provided
above, if cell C2 was set to 2 then cell D2 would update to Beta Client.
2.3) Calculated Percent Complete
Create a formula to calculate the percent complete for each project. Use an IF function to make sure only
valid division occurs (cannot divide by 0). For example:
=IF( AND( F2>0, ISNUMBER(F2) ), G2/F2, "No Estimate" )
Use VLOOKUP to automatically populate the Client name in the hours sheet based on the value of the Client
id (that was populated in step 3.2).
3.4) Compute Amount
If not already set up in the previous lab, use a formula to calculate the total amount due, based on the
number of hours and the rate.
4.0) Calculate Hours For Each Project
In the project sheet, use the SUMIF function to calculate the number of hours for each project. Use the
Project id as the condition for the SUMIF. For example, based on the sheets presented above cell G2 in the
project sheet will have the following formula:
=SUMIF(hours!$C:$C,A2,hours!$B:$B)
Sheet Projects:
Sheet Hours:
6/7
Lab2.md 1/18/2023
Note: grey columns are filled automatically, blue columns require user input.
Your Excel sheet should meet the following criteria, future lab exercises will depend on this deliverable:
The Clients sheet should have:
Client Id (a number that is unique for every client)
Client Name
The Projects sheet should have:
Project Id (a number that is unique for each project, input)
Project Name (input)
Client Id (matches an Id from the Clients sheet)
Client Name (based on client ID, auto populated using VLOOKUP)
Rate ($/hour, input)
Hours Estimated (how long you think the project will take, input).
Hours Total (the number of hours tracked for this project so far, calulated using formula).
Percent Complete (Total Hours / Estimated Hours)
The Hours sheet should have:
. Date (yyyy-mm-dd or yyyy/mm/dd or dd/mm/yyyy, input).
. Number of hours (two decimal places, input)
. The project ID (input)
. A project name (based on project ID, auto populated using VLOOKUP)
. A client ID (based on project name, auto populated using VLOOKUP)
. A client name (based on client ID, auto populated using VLOOKUP)
. The rate (based on project ID, auto populated using VLOOKUP)
. Total amount due (calculated)
. Description
If calculating the "Percent Complete" would result in division by zero, display an error message.
If an Id (client or project) is entered that does not correspond to a client or project in the respective
sheet display an error message.
7/7