How to use the COUNTIF function in Google Sheets to determine a number of items within a specific condition

businessman at office on laptop
The COUNTIF function in Google Sheets is useful for finding specific pieces of data.

  • You can use the COUNTIF function in Google Sheets to find the number of items in a range that meet certain criteria.
  • You can use text, numbers, and dates as criteria in the COUNTIF function.
  • COUNTIF is an easy way to find out how many rows in a spreadsheet contain a blank cell, for example.
  • Visit Insider’s Tech Reference library for more stories.

Like Microsoft Excel, Google Sheets includes a simple COUNT function that tells you the number of items in the selected range. But what if you want to know the number of items based on some condition – like only the products in a list that are below a certain price, or only the cities in a specific state? That’s when you would use the COUNTIF function.

As the name implies, COUNTIF combines the abilities of COUNT and IF – it checks to see if the IF argument is true before returning the COUNT value. Here’s what the function looks like:

=COUNTIF(range, criterion)
  • Range: This is the range of cells you want to test against some sort of criterion and then sum.
  • Criterion: This is what you want to use to test against the range. You can use a number, text, or even a date as your criterion.

How to use COUNTIF in Google Sheets with a number condition

Using COUNTIF in your own Google Sheets is pretty straightforward, since you only need to specify two arguments. Suppose you had a spreadsheet like this in which you wanted to know how many items cost less than $500.

How_to_use_COUNTIF_in_Google_Sheets 1
You can use the COUNTIF function to find the number of items in this list that cost less than $500.

1. Type “COUNTIF” and press the Tab key. Google Sheets automatically adds the open parenthesis.

2. Click and drag the mouse to select the column that has the pricing information.

3. Type a comma and then enter the criteria – in this case “<500” (include the quotes).

4. Press the Tab key. Google Sheets will close the parenthesis and display the result in the cell.

How_to_use_COUNTIF_in_Google_Sheets 2
COUNTIF is simple to use in part because it has just two arguments.

How to use COUNTIF with a text condition

The COUNTIF function can also sum items based on text criteria. If you needed to find out how many items in a list have a particular color, you would do this:

1. Type “COUNTIF” and press the Tab key. Google Sheets automatically adds the open parenthesis.

2. Click and drag the mouse to select the column that has the color information.

3. Type a comma and then enter the criteria, such as “blue” (include the quotes).

4. Press the Tab key. You should see the result.

How_to_use_COUNTIF_in_Google_Sheets 3
You can use a text criterion to find how many items have that matching text.

If you’re looking for the sum of all the cells that don’t have this value, that’s easy to do as well – just use the NOT operator, like this:

=COUNTIF(A1:A12,"<>blue")

Likewise, the COUNTIF function is often used to find the number of entries that are blank, or the number that are not blank. This can be handy for cleaning up a messy spreadsheet. Find the blanks with a pair of quotes with nothing between:

=COUNTIF(A1:A12,"")

And the non-blank entries can be found with a NOT operator:

=COUNTIF(A1:A12,"<>")

How to use COUNTIF with a wildcard

Wildcards can come in handy because they help you find partial matches, such as all the descriptions that mention the color red.

1. Type “=COUNTIF” and press the Tab key.

2. Click and drag the mouse to select the column with the product descriptions.

3. Type a comma and then enter “*red*” (include the quotation marks).

4. Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell.

In this example, we’re looking for cells that contain the word red anywhere. But you could use “*red” to find cells that end with the word red or “red*” for cells that begin with red.

How to use COUNTIF with a date condition

The COUNTIF function can return the number of items that correspond to a particular date. Suppose we want to total all the sales that happened on January 15.

1. Type “=COUNTIF” and press the Tab key.

2. Click and drag the mouse to select the column with the range of dates.

3. Type a comma and then enter “DATE(2021, 1,15)” (do not include the quotation marks).

4. Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell.

As you can probably guess, you can use variations of this argument with logical operators:

  • =COUNTIF(D1:D8,”>=”&DATE(2021,1,7)). This returns the number of items dated on or after January 7.
  • =COUNTIF(D1:D8,”<>”&DATE(2021,1,7)). This returns the number of items with any date other than January 7.
How_to_use_COUNTIF_in_Google_Sheets 4
By combining logical operators with the date, you can find the number of items that are associated with a specific date range.

How to use VLOOKUP in Google Sheets to search for specific data and replicate it across spreadsheetsHow to use the IMPORTRANGE function in Google Sheets to keep multiple spreadsheets in syncHow to use the SUMIF function in Google Sheets to find a specific sum in your spreadsheetThe 35 best Google Sheets keyboard shortcuts for speeding up your workflow on a Mac or PC

Read the original article on Business Insider

How to use the SUMIF function in Google Sheets to find a specific sum in your spreadsheet

typing on computer with spreadsheets
You can use SUMIF on Google Sheets to calculate a sum based on various conditions.

It’s easy to add a set of numbers together – every spreadsheet user knows how to use the tried-and-true SUM function to find a total. But what if the sum you’re trying to find depends on some sort of condition? Suppose, for example, you have a set of numbers and you only want to add up the ones that are below a certain max value. Or perhaps you have your company’s sales tally and want to know only the sales from a particular region or sales from a certain time period.

That’s where Google Sheets’ SUMIF function comes in. You can use SUMIF to calculate a sum based on a condition. That condition can be built into the set of values themselves, or numbers that are related to a neighboring row or column. If that sounds complicated, the good news is that it’s easy to apply.

How to use the SUMIF function in Google Sheets

As the name of the function implies, SUMIF is conditional and checks for a status using the IF function before totaling your numbers. This is what the function looks like:

=SUMIF(range, criterion, [sum_range])

  • Range: The range is the set of cells that you want to test against some sort of criterion.
  • Criterion: This is what you want to use to test against the range. The SUMIF function is pretty versatile – you can use a number, text, or even a date as the criterion.
  • Sum_range: The sum_range is optional, and is what gives this function so much power. If you omit the sum_range, the function will sum the range. But you have the option of summing a different range depending on the result of the conditional test.

Tips for using SUMIF in Google Sheets

Once you’ve used the SUMIF function a few times, you’ll probably find that it’s pretty straightforward, both with and without the optional argument. But here are a few tips to keep in mind to get the most out of SUMIF:

  • The SUMIF function can only be used to evaluate one condition. If you need to work with several criteria at once, you might need to switch to the SUMIFS function.
  • When you use the optional sum_range, it doesn’t have to be right next to the range, but it does need to include the same number of cells.
  • If you include a text argument in SUMIF, it isn’t case-sensitive – and you can’t make it case-sensitive, so it will treat “apple,” “Apple,” and “APPLE” the same way.
  • Remember to use quotes to enclose elements like text and logical operators, like “apple” and “>=1”
  • If you need to combine two elements in the argument – like a greater than operator and date, for example, use an ampersand to join them.

How to use VLOOKUP in Google Sheets to search for specific data and replicate it across spreadsheetsHow to convert your Google Sheets files into Excel files, and edit them in Microsoft ExcelHow to see the edit history for cells in Google Sheets and spot changes or mistakes in a spreadsheetHow to add cells in Google Sheets on your PC or Mac

Read the original article on Business Insider

What is a CSV file? How to open, use, and save the popular spreadsheet file in 3 different apps

business professional using laptop in cafe
A CSV file is a plain text file that can be opened in a variety of programs.

  • A CSV (comma-separated values) file is a simple text file in which information is separated by commas.
  • CSV files are most commonly encountered in spreadsheets and databases.
  • You can use a CSV file to move data between programs that aren’t ordinarily able to exchange data.
  • Visit Insider’s Tech Reference library for more stories.

If you spend any time with spreadsheet applications like Microsoft Excel or Google Sheets – or even import certain kinds of data into Microsoft Outlook – you will inevitably encounter a comma-separated values file, commonly known as a CSV.

A CSV file is a simple text file that you can open in a wide variety of programs, including any program that works with plain text like the Notepad app; what makes a CSV file unique is the way its content is organized.

What to know about a CSV file

A CSV file, as the name implies, typically separates information using commas. It’s a way to exchange structured information, like the contents of a spreadsheet, among programs that can’t necessarily talk to one another directly.

As long as two programs can both open a CSV file, they can exchange data. For example, you can save contact information from Microsoft Excel as a CSV file, and import it into the address book in Microsoft Outlook.

A typical CSV file looks like this, where each line contains the same sequence of data so any program which needs to read it knows what to expect:

Product, Size, Color, Price

Shirt, Medium, Blue, $14

Shirt, Large, Red, $15

Pants, Medium, Khaki, $23

Despite the name, a CSV doesn’t need to rely on commas as the separator between pieces of information. This separator, called a delimiter, can be a semicolon, space, or some other character, though the comma is most common.

And of course, once you’ve imported your CSV file into any of these programs, you can then edit the data like you would with any other file.

How to split cells into columns in Microsoft Excel using the ‘Text to Columns’ featureHow to convert an Excel spreadsheet to a Google Sheets documentHow to see the edit history for cells in Google Sheets and spot changes or mistakes in a spreadsheetThe 35 best Google Sheets keyboard shortcuts for speeding up your workflow on a Mac or PC

Read the original article on Business Insider