Data Queries
2026-01-28
HW 3 is due 2/2/2026
Sign up for a FREE Posit Cloud Account before Tuesday, 2/3/26
Data Set Queries
VLOOKUP
VLOOKUP with Data Validation
VLOOKUP with MATCH command
VLOOKUP with Range option
Poll Everywhere - My User Name: penelopepoolereisenbies685
The Pivot Table below shows the COUNTS of Titanic passengers in each class that did or did not survive the disaster.
Question 1. If we want to know the percent of passengers that survived (Yes) that were in second class, what option should we select for Show Values As?
Should we select % of Column Total, % of Row Total or % of Grand Total?
Question 2. If we want to know the percent of ALL passengers that were in third class and did not survive, what option should we select for Show Values As?
A useful skill is to be able to find specific observations quickly in a large database.
Excel facilitates this process with these commands:
You are working for a Non-profit that offers celebrity autographs in exchange for donations, so you need to contact celebrities.
This first worksheet only has 5 observations, but what if it had 200?
You want to find a phone number quickly, just based on STAGE NAME.
VLOOKUP CommandVLOOKUP inputsG2: Where reference value is entered (see Worksheet 1)
B2:D6: Data range to be searched
Note: VLOOKUP requires that Column with reference value is FIRST COLUMN (Index = 1)
STAGE NAME (Column B) is first column
3: Column index where query answer is.
FALSE: We enter FALSE to indicate we want an EXACT MATCH
VLOOKUP Example 2G2: Where reference value is entered (see Worksheet 1)
??:???: Data range to be searched
Note: VLOOKUP requires that Column with reference value is FIRST COLUMN (Index = 1)
STAGE NAME (Column A) is first column
?: Column index where query answer is.
FALSE: We enter FALSE to indicate we want an EXACT MATCH
Poll Everywhere - My User Name: penelopepoolereisenbies685
Using the Worksheet 2 Database, we want to find Beyonce’s phone number phone number, but there’s a common problem.
The accent in Beyonce’s name causes an error.
How do we deal with this?
We use ‘Data Validation’ to restrict options for G2 to ONLY VALID entries.
Worksheet 3 contains Syracuse weather data from October 2025 to January 27, 2026.
NOTE: Data were aggregated from the National Weather Service and values of ‘T’ (trace amounts) were replaced with 0 for this example.
We want to create a query that will output a value when the user specifies a date AND a weather variable.
Poll Everywhere - My User Name: penelopepoolereisenbies685
The example VLOOKUP command on slide 12 is set up to show the snowfall for different dates.
If we want to know the minimum temperature for different dates, what would change in our VLOOKUP command?
HINT: The third input before FALSE is the only input that needs to change.
3rd input would change from 5 to 1.
3rd input would change from 5 to 2.
3rd input would change from 5 to 3.
3rd input would change from 5 to 4.
MATCH commandHow do we AUTOMATE the lookup column in the VLOOKUP below? We want the command to update automatically when we choose a new weather variable?
We need to convert these to ranges that Excel can understand.
Range lookup will only work with lower limits in ASCENDING ORDER.
In Cell B1, we will add data validation so that we have a pull-down list of Hurricane names.
In Cell B2, we will create a VLOOKUP command that outputs the maximum wind speed.
In cell B3 we will create a VLOOKUP with a range option that will output the category of the hurricaine.
Poll Everywhere - My User Name: penelopepoolereisenbies685
Based on the completed query table, what category was Hurricane Rina?
Select Category 1, 2, 3, 4, or 5.
Queries using VLOOKUP command
Useful for creating automated searches
VLOOKUP very useful for LARGE data sets
VLOOKUP Query with ‘Data Validation’
VLOOKUP with MATCH command
VLOOKUP with RANGE lookup
HW 3 is due 2/2/2026
To submit an Engagement Question or Comment about material from Lecture 6: Submit it by midnight today (day of lecture).