Spreadsheets Tutorial: IF functions

DataCamp · Beginner ·🛠️ AI Tools & Apps ·6y ago

Key Takeaways

This video tutorial by DataCamp covers the use of IF functions in spreadsheets, specifically the COUNTIF, AVERAGEIF, and SUMIF functions, to calculate summaries based on different groups of data.

Full Transcript

nice work summarizing the data you probably noticed that these summaries don't help us much yet they would be more useful if we could calculate summaries based on different groups of data such as by precinct or crime type in this video you will learn about functions that only include data if they meet certain conditions let's take a look to count the number of crimes by precinct or compute the average time by precinct we first need a list of all the possible values of that column this is a perfect use for the unique function it takes a set of data and returns an unduplicated list of the distinct values in the column for example calling the unique function on the C column will give you a list of all the precinct names in our data set listing each precinct only once now that you have a list of all possible values you can easily compute summary statistics for groups within the data set for example you might want to count the number of Records for each group such as the number of crimes by precinct you can use the countif function to do this it takes two arguments the range refers to the cells that you want to count and the criterion refers to the value that you want to count so you can use the unique list of precincts and the countif function to count the number of crimes per precinct you can also count the number of crimes that occurred after 8:00 o'clock by changing the criteria to all crimes with a time greater than 2000 recall that our data list times in 24-hour form we can also use the average if and some if functions to compute GroupWise summary statistics these functions take three arguments instead of the two required by count if they require a criteria range a criterion and arrange to which they apply the function for example you can calculate the average time at which a crime occurred by specifying the criterion range as the column that contains precinct names the criterion as the name of the precinct of interest and the column containing x as the range to which to apply the function similarly you can calculate the sum of crimes in various precincts by specifying the range of columns that contain precinct names the criterion to evaluate and the column containing counts of crimes in those precincts as the range to apply the sum function so that will help us improve the insights from our data but what if you want to restrict your counts averages or sums based on multiple criteria fortunately spreadsheets has functions that do just that let's start with the countifs function it takes a practically unlimited number of pairs of arguments that we typically provide no more than three criteria and it allows for multiple criteria you can even apply different criteria to the same range as you might need to if you only wanted to count crimes between 8:00 o'clock and midnight let's consider an example say you want to count the number of crimes in the West precinct that occurred after 8 o'clock in the evening you would call the countifs function specify the first range then the criteria to check then the second range and the criteria to check we can use the average ifs function similarly the order of the arguments in the average of this function is a bit different from that of countifs for example the first argument of average ifs is the range of cells to include in the average not the first criteria range it also takes pairs of ranges and criteria and allows for multiple criteria for the same range now you're armed with multiple functions for creating and counting groups of data let's get some

Original Description

Want to learn more? Take the full course at https://learn.datacamp.com/courses/error-and-uncertainty-in-spreadsheets at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work. --- Nice work summarizing the data. You probably noticed that these summaries don't help us much yet. They would be more useful if we could calculate summaries based on different groups of data, such as by precinct or crime type. In this video you will learn about functions that only include data IF they meet certain conditions. Let's take a look. To count the number of crimes by precinct or compute the average time by precinct, we first need a list of all the possible values of that column. This is a perfect use for the UNIQUE() function. It takes a set of data and returns an unduplicated list of the distinct values in the column. For example, calling the UNIQUE() function on the C column will give you a list of all the precinct names in our dataset, listing each precinct only once. Now that you have a list of all possible values, you can easily compute summary statistics for groups within the dataset. For example, you might want to count the number of records for each group, such as the number of crimes by precinct. You can use the COUNTIF() function to do this. It takes two arguments: the range refers to the cells that you want to count, and the criterion refers to the value that you want to count. So you can use the unique list of precincts and the COUNTIF() function to count the number of crimes per precinct. You could also count the number of crimes that occurred after 8:00 by changing the criteria to all crimes with a time greater than 2000. Recall that our data list times in 24-hour format. We can also use the AVERAGEIF() and SUMIF() functions to compute group-wise summary statistics. These functions take three arguments instead of the two required by COUNTIF(): They require a criteria range, a criterion, and a range to
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from DataCamp · DataCamp · 0 of 60

← Previous Next →
1 SQL Server Tutorial: Date manipulation
SQL Server Tutorial: Date manipulation
DataCamp
2 R Tutorial: Intermediate Interactive Data Visualization with plotly in R
R Tutorial: Intermediate Interactive Data Visualization with plotly in R
DataCamp
3 R Tutorial: Adding aesthetics to represent a variable
R Tutorial: Adding aesthetics to represent a variable
DataCamp
4 R Tutorial: Moving Beyond Simple Interactivity
R Tutorial: Moving Beyond Simple Interactivity
DataCamp
5 Python Tutorial: Why use ML for marketing? Strategies and use cases
Python Tutorial: Why use ML for marketing? Strategies and use cases
DataCamp
6 Python Tutorial: Preparation for modeling
Python Tutorial: Preparation for modeling
DataCamp
7 Python Tutorial: Machine Learning modeling steps
Python Tutorial: Machine Learning modeling steps
DataCamp
8 R Tutorial: The prior model
R Tutorial: The prior model
DataCamp
9 R Tutorial: Data & the likelihood
R Tutorial: Data & the likelihood
DataCamp
10 R Tutorial: The posterior model
R Tutorial: The posterior model
DataCamp
11 R Tutorial: An Introduction to plotly
R Tutorial: An Introduction to plotly
DataCamp
12 R Tutorial: Plotting a single variable
R Tutorial: Plotting a single variable
DataCamp
13 R Tutorial: Bivariate graphics
R Tutorial: Bivariate graphics
DataCamp
14 Python Tutorial: Customer Segmentation in Python
Python Tutorial: Customer Segmentation in Python
DataCamp
15 Python Tutorial: Time cohorts
Python Tutorial: Time cohorts
DataCamp
16 Python Tutorial: Calculate cohort metrics
Python Tutorial: Calculate cohort metrics
DataCamp
17 Python Tutorial: Cohort analysis visualization
Python Tutorial: Cohort analysis visualization
DataCamp
18 R Tutorial: Building Dashboards with flexdashboard
R Tutorial: Building Dashboards with flexdashboard
DataCamp
19 R Tutorial: Anatomy of a flexdashboard
R Tutorial: Anatomy of a flexdashboard
DataCamp
20 R Tutorial: Layout basics
R Tutorial: Layout basics
DataCamp
21 R Tutorial: Advanced layouts
R Tutorial: Advanced layouts
DataCamp
22 Python Tutorial: Time Series Analysis in Python
Python Tutorial: Time Series Analysis in Python
DataCamp
23 Python Tutorial: Correlation of Two Time Series
Python Tutorial: Correlation of Two Time Series
DataCamp
24 Python Tutorial: Simple Linear Regressions
Python Tutorial: Simple Linear Regressions
DataCamp
25 Python Tutorial: Autocorrelation
Python Tutorial: Autocorrelation
DataCamp
26 R Tutorial: The gapminder dataset
R Tutorial: The gapminder dataset
DataCamp
27 R Tutorial: The filter verb
R Tutorial: The filter verb
DataCamp
28 R Tutorial: The arrange verb
R Tutorial: The arrange verb
DataCamp
29 R Tutorial: The mutate verb
R Tutorial: The mutate verb
DataCamp
30 R Tutorial: What is cluster analysis?
R Tutorial: What is cluster analysis?
DataCamp
31 R Tutorial: Distance between two observations
R Tutorial: Distance between two observations
DataCamp
32 R Tutorial: The importance of scale
R Tutorial: The importance of scale
DataCamp
33 R Tutorial: Measuring distance for categorical data
R Tutorial: Measuring distance for categorical data
DataCamp
34 Python Tutorial: Plotting multiple graphs
Python Tutorial: Plotting multiple graphs
DataCamp
35 Python Tutorial: Customizing axes
Python Tutorial: Customizing axes
DataCamp
36 Python Tutorial: Legends, annotations, & styles
Python Tutorial: Legends, annotations, & styles
DataCamp
37 Python Tutorial: Introduction to iterators
Python Tutorial: Introduction to iterators
DataCamp
38 Python Tutorial: Playing with iterators
Python Tutorial: Playing with iterators
DataCamp
39 Python Tutorial: Using iterators to load large files into memory
Python Tutorial: Using iterators to load large files into memory
DataCamp
40 SQL Tutorial: Introduction to Relational Databases in SQL
SQL Tutorial: Introduction to Relational Databases in SQL
DataCamp
41 SQL Tutorial: Tables: At the core of every database
SQL Tutorial: Tables: At the core of every database
DataCamp
42 SQL Tutorial: Update your database as the structure changes
SQL Tutorial: Update your database as the structure changes
DataCamp
43 Python Tutorial: Classification-Tree Learning
Python Tutorial: Classification-Tree Learning
DataCamp
44 Python Tutorial: Decision-Tree for Classification
Python Tutorial: Decision-Tree for Classification
DataCamp
45 Python Tutorial: Decision-Tree for Regression
Python Tutorial: Decision-Tree for Regression
DataCamp
46 Python Tutorial: Census Subject Tables
Python Tutorial: Census Subject Tables
DataCamp
47 Python Tutorial: Census Geography
Python Tutorial: Census Geography
DataCamp
48 Python Tutorial: Using the Census API
Python Tutorial: Using the Census API
DataCamp
49 R Tutorial: A/B Testing in R
R Tutorial: A/B Testing in R
DataCamp
50 R Tutorial: Baseline Conversion Rates
R Tutorial: Baseline Conversion Rates
DataCamp
51 R Tutorial: Designing an Experiment - Power Analysis
R Tutorial: Designing an Experiment - Power Analysis
DataCamp
52 R Tutorial: Introduction to qualitative data
R Tutorial: Introduction to qualitative data
DataCamp
53 R Tutorial: Understanding your qualitative variables
R Tutorial: Understanding your qualitative variables
DataCamp
54 R Tutorial: Making Better Plots
R Tutorial: Making Better Plots
DataCamp
55 SQL Tutorial: OLTP and OLAP
SQL Tutorial: OLTP and OLAP
DataCamp
56 SQL Tutorial: Storing data
SQL Tutorial: Storing data
DataCamp
57 SQL Tutorial: Database design
SQL Tutorial: Database design
DataCamp
58 Python Tutorial: Introduction to spaCy
Python Tutorial: Introduction to spaCy
DataCamp
59 Python Tutorial: Statistical Models
Python Tutorial: Statistical Models
DataCamp
60 Python Tutorial: Rule-based Matching
Python Tutorial: Rule-based Matching
DataCamp

This video teaches how to use IF functions in spreadsheets to calculate summaries based on different groups of data, making it easier to analyze and understand data. The tutorial covers the COUNTIF, AVERAGEIF, and SUMIF functions, as well as the unique function. By the end of the lesson, viewers will be able to apply these functions to their own data analysis tasks.

Key Takeaways
  1. Use the unique function to get a list of distinct values in a column
  2. Use the COUNTIF function to count the number of records for each group
  3. Use the AVERAGEIF function to calculate the average value for each group
  4. Use the SUMIF function to calculate the sum of values for each group
  5. Apply multiple criteria using the COUNTIFS and AVERAGEIFS functions
💡 The IF functions in spreadsheets can be used to calculate summaries based on different groups of data, making it easier to analyze and understand data.

Related AI Lessons

Up next
I Asked ChatGPT to Apply to 500 Jobs (8 Interviews in 48 Hours)
Sabrina Ramonov 🍄
Watch →