The Wayback Machine - https://web.archive.org/web/20240902163812/https://www.geeksforgeeks.org/sumif-in-google-sheets-with-formula-examples/
Open In App

SUMIF in Google Sheets with formula examples

Last Updated: 27 Aug, 2024

S

Improve
Suggest changes
Like Article
Like
Save
Share
Report

Mastering data analysis with the SUMIF function in Google Sheets! This essential tool allows you to add up values that meet specific criteria, making it perfect for tracking expenses, analyzing sales data, and more. With SUMIF in Google Sheets, you can effortlessly sum values based on conditions you set, streamlining your data management tasks.

SUMIF-in-Google-Sheets-with-formula-examples

SUMIF in Google Sheets

Syntax and Basic Uses of SUMIF in Google Sheets

Understand the basic syntax and uses of the SUMIF function in Google Sheets to get started with this powerful tool.

=SUMIF(range, criterion, sum_range)

range: Range of cells where the condition has to be checked.

criterion: The condition that has to be matched with the cells specified in the range above.

sum_range(optional): The range of cells with numerical data that has to be summed up. If this is not specified, then the first range is checked for condition and summed up.

SUMIF is useful in managing financial records or databases, tracking sales performance and much more.

SUMIF Formula Examples in Google Sheets

Explore various examples of SUMIF formulas to understand how to use this function in different scenarios.

1. SUMIF Formulas with Text Criteria

Let us consider the following data. Table 1 “Book-wise Data” has a list of books along with their genre and no. of available copies.

SUMIF in Google Sheets

Sample Data of a Library where there are books belonging to different genres.

(i) SUMIF equal to (exact match):

=SUMIF(C3:C18,”Adventure”,D3:D18)

SUMIF in Google Sheets

Equal to

Explanation: Finds “Adventure” in the range C3:C18 and sums their corresponding values found in range D3:D18. Hence it will give us the total number of books of the adventure genre.

Note: The condition should always be written within double quotes(“”) and it is not case sensitive-“Adventure” and “adventure” are considered the same.

(ii) SUMIF not equal to (Exact match)

=SUMIF(C3:C18,”<>Adventure”,D3:D18)

SUMIF in Google Sheets

Not equal to

Explanation: The formula returns the sum of all those books whose genre is NOT “adventure”.

2. SUMIF Formulas with WildCard Characters

The following formulas are useful to match the text partially with the cell contents.

(i) SUMIF cell contains (Partial Match)

=SUMIF(B3:B18, “*abridged*”, D3:D18)

SUMIF in Google Sheets

Cell contains

Explanation: This gives us the number of books which are abridged. It looks for the word “abridged” in the cell range B3:B18 and sums corresponding values found in range D3:D18.

(ii) SUMIF cell does not contain (Partial match)

=SUMIF(B3:B18, “<>*abridged*”, D3:D18)

SUMIF in Google Sheets

Cell does not contain

Explanation: Whichever cell in range B3:B18 does not contain the text “abridged”, its corresponding number of copies is summed up to give the result.

(iii) Case-sensitive SUMIF in Google Sheets

As already mentioned above, the SUMIF function is case-insensitive, to differentiate between uppercase and lowercase text, the following syntax can be used.

=SUMIF(ArrayFormula(EXACT(criterion, range)), TRUE, sum_range)

or

=SUMIF(ArrayFormula(FIND(criterion, range)), 1, sum_range)

In our case, if we want to find books that belong to genre “Adventure” only and not “adventure”, the formula would look like:

SUMIF in Google Sheets

Finding only “Adventure” and not “adventure”

3. How SUMIF-EXACT/FIND formula works

=SUMIF(ArrayFormula(EXACT(criterion, range)), TRUE, sum_range)

ArrayFormula makes EXACT comparisons to the criterion provided with the values in range. If an Exact Match is found, the formula returns True, otherwise False.

Out of the True and False values in the range, SUMIF searches for True values and sums up corresponding values in Sum_range.

Similarly, if we use the FIND function separately, it will stop searching as soon as it finds the first match. Wherever the match is found, it returns a 1 and #VALUE! error for cells where the value is not found.

=SUMIF(ArrayFormula(FIND(criterion, range)), 1, sum_range)

4. SUMIF formulas for numbers

The criterion need not always be text. Let’s say we want to find the number of books whose number of copies is more than 50. In such cases the following formulas can be used.

(i) SUMIF greater than or less than

To find the number of books whose number of copies is more than 50,

=SUMIF(C22:C26, “>50”)

SUMIF in Google Sheets

SUMIF greater than or less than

Here the sum_range has been eliminated since the range and sum_range both were the same in this case. In cases where they are different, sum_range needs to be specified.

=SUMIF(D3:D18, “<50”,D3:D18)

This can also be done using cell referencing using the “&”(ampersand) . If the value in cell D21 is 50 then we can use:

=SUMIF(C22:C26, “>”&D21)

SUMIF in Google Sheets

SUMIF greater than or less than

For other comparison criteria, the following logical operators can be used.

Greater than

>

Greater than or equal to

>=

Less than

<

Less than or equal to

<=

(ii) SUMIF equal to

To find the number of books whose number of copies is equal to 50,\

=SUMIF(C22:C26, 50)

SUMIF in Google Sheets

SUMIF equal to

or

=SUMIF(C22:C26, “=50”)

SUMIF in Google Sheets

SUMIF equal to

or (using cell referencing, if cell D21 has value 50)

=SUMIF(C22:C26, D21)

SUMIF in Google Sheets

SUMIF equal to

Note: If the value is directly being specified, then it should be written without quotation marks, otherwise if it is being used with “=” sign, then quotation marks should be used.

Again, if the sum_range is not the same as range then it needs to be specified separately.

(iii) Sum if not equal to

This is similar to the not equal to criterion in text. To find the total number of books whose number of copies is not equal to 50, we can use the formula:

=SUMIF(C22:C26, “<>50”,C22:C26)

or (using cell referencing, if cell E2 has value 50)

=SUMIF(C22:C26, “<>”&D21,C22:C26)

SUMIF in Google Sheets

Sum if not equal to

5. Google Sheets SUMIF formulas for dates

Google sheets can sum up values based on dates but a specific format for comparing the dates is to be followed. If I want to sum values of books bought before a date of format DD/MM/YYYY, then we can use one of the following:

=SUMIF(range, “<MM/DD/YYYY”, sum_range)

or

=SUMIF(range, “<“&DATE(YYYY,MM,DD), sum_range)

or if the date is written in the cell E22 in the format MM/DD/YYYY, then

=SUMIF(range, “<“&E22, sum_range)

SUMIF in Google Sheets

Google Sheets SUMIF formulas for dates

Similarly, other logical operators given in the table earlier in this article can be used for other comparisons.

To sum cells based on TODAY’s date, TODAY() function can be included.

For example, to check number of books bought today (today is 30 May 2024),

=SUMIF(C22:C26, TODAY(), D22:B26)

SUMIF in Google Sheets

Google Sheets SUMIF formulas for dates

6. Sum based on blank or non-blank cells

To sum values whose value in a certain column is blank or not blank we may use the following in criterion:

“=” (SUMIF Blank)

completely blank cells

“”(SUMIF Blank)

cells including those that contain zero length strings

“<>”(SUMIF Not blank)

cells with any value, including zero length strings

(i) SUMIF Blank

To find the total number of books whose date of purchase is not mentioned:

=SUMIF(C22:C26,””, D22:D26)

SUMIF in Google Sheets

SUMIF Blank

(ii) SUMIF Not blank

To find the total number of books whose date of purchase is mentioned(not blank):

=SUMIF(C22:C26,”<>”, D22:D26)

SUMIF in Google Sheets

SUMIF Not blank

7. Google Sheets SUMIF with multiple criteria (OR logic)

Google sheets lets us sum values based on multiple criteria. Let’s say we want to find the total number of books belonging to genre “Horror” or “Thriller”, we can apply the multiple criteria formula:

=SUMIF(C3:C18,”Horror”,D3:D18)+SUMIF(C3:C18,”Thriller”,D3:D18)

SUMIF in Google Sheets

Google Sheets SUMIF with multiple criteria (OR logic)

This formula works even if any one of the criteria is fulfilled (OR Logic).

Google Sheets SUMIF – Things to Remember

Now that we know a lot about the usage of SUMIF in google sheets, let us not forget to keep these points in mind while using this function:

1. SUMIF can evaluate only one condition

The SUMIF syntax allows only using one range, one criterion and one sum_range. To apply multiple criteria, two formulas can be added (as shown above)

2. The SUMIF function is case-insensitive

If we put “Adventure” in the exact match criterion, then it considers both “adventure” and “Adventure” as same and sums up corresponding values for both.

3. Supply equally sized range and sum_range

Only equal sized ranges can be used. If the range is C3:C18 then sum_range must be D3:D18 and not D3:D20.

4. Mind the syntax of SUMIF criteria

If the criterion is text, wildcard character or logical operator (followed by a number, text or date) it must be enclosed in quotation marks.

=SUMIF(C3:C18,”Horror”,D3:D18) =SUMIF(C3:C18,”*”,D3:D18) =SUMIF(D3:D18,”>50″) =SUMIF(C3:C18,”<>Horror”,D3:D18)

Otherwise, if it contains a logical operator and a cell reference or another function then the cell reference or function should not be enclosed in quotes.

=SUMIF(D3:D18,”>”&E2) =SUMIF(D3:D18,”>”&TODAY())

5. Lock ranges with absolute cell references if needed

In cases where we autofill the cells with SUMIF formula or copy-paste the formula somewhere else and we do not want the cell addresses to change then we must lock them using $ symbol.

=SUMIF($C$3:$C$18,”<>Horror”,$D$3:$D$18)

Conclusion

To leverage the full potential of a dataset, mastering the advanced functions provided by spreadsheets is one way. SUMIF provides an efficient method to isolate and add relevant data without disturbing the other values. This function not only saves one’s time but also improves the precision of the decision making process.

FAQs on SUMIF in Google Sheets

What is the difference between SUMIF and SUMIFS?

SUMIF sums values based on a single criterion, whereas SUMIFS can sum values based on multiple criteria. Example for SUMIFS: =SUMIFS(B2:B10, A2:A10, “>100”, C2:C10, “<50”).

Can SUMIF handle criteria with text and numbers combined?

Yes, SUMIF can handle criteria that combine text and numbers. Example: =SUMIF(A2:A10, “Item*”&100, B2:B10) sums values in B2:B10 where A2:A10 starts with “Item” followed by “100”.

Can I use regular expressions in SUMIF?

SUMIF does not support regular expressions, but you can achieve similar functionality with array formulas or FILTER. Example: =SUM(FILTER(B2:B10, REGEXMATCH(A2:A10, “^A.*”))) sums values in B2:B10 where A2:A10 matches the regular expression.

How can I sum values conditionally across different sheets?

You can refer to different sheets in your SUMIF formula. Example: =SUMIF(Sheet2!A2:A10, “>100”, Sheet2!B2:B10) sums values in Sheet2!B2:B10 based on the condition in Sheet2!A2:A10.

Can SUMIF be used with custom functions or scripts in Google Sheets?

Yes, you can enhance SUMIF with custom Google Apps Script functions for more complex criteria. Example: Write a custom function to handle advanced filtering and summing.



S

Improve
Save
Discuss

How to Copy a Formula Down an Entire Column in Google Sheets

article_img
Imagine having a superpower that can enhance your productivity in Google Sheets. Well, copying formulas down an entire column in the one. Instead of doing the same calculations again and again, you can easily do your tasks by using this method. It's like having a clone army of formulas at your command, ready to perform repetitive calculations with lightning speed. Let's get in and unlock the magic of copying formulas in Google Sheets! Apply formula to the entire column Copy a Formula in Google SheetsGoogle Sheets Copy Formula DownHow to Copy a Formula Down an Entire Column in Google SheetsGoogle Sheets Copy Formula Down ShortcutConclusionFAQs - Google Sheets Copy Formula Down Entire ColumnCopy a Formula in Google SheetsCopying formulas in Google Sheets allows you to quickly replicate calculations across multiple cells, making it efficient and time-saving for repetitive tasks. Instead of manually typing out the same formula for each cell, you can simply copy it down a column, letting Google Sheets do the work for you. This saves time and reduces the chances of errors, ensuring consistency and accuracy in your calculations. Google Sheets Copy Formula DownCopying a formula downward in
Read More

Create a BMI Calculator using Google Forms and Google Sheets

article_img
How to Create BMI Calculator in Google Forms What is BMI?How to Create a Google Form for BMI CalculationCreating a Google Form for BMI CalculationEstablishing the BMI calculatorBMI Calculations in Google SheetsConclusionFAQS on BMI Calculator Tired of those confusing weight charts and old-fashioned BMI calculators? Want a quick and easy way to see your Body Mass Index (BMI) on your phone? We got you covered! This trick uses Google Forms and Sheets to create a super simple BMI calculator. No fancy machines or confusing numbers – just a quick form, a few taps, and there you have it – your personal BMI! Ready to ditch the mystery and check your BMI in a fun new way? Let's get started! What is BMI?The Body Mass Index (BMI) is Someone's weight and height ratio. This number is a rough approximation of the person's fat percentage. Since the score is proportional to fat mass, a higher number indicates that the individual has a higher fat mass. A person's Underweight, Normal Weight, or Overweight status is determined by their Body Mass Index (BMI). Variables like age and geographic region determine the BMI range.  Body Mass Index Result Less than 18.5 Underweight 18.5-24.9 Healthy 25.0-29.9
Read More

How to Insert a Google Sheets into a Google Docs: A Step-by-Step Guide

article_img
Have you ever wanted to add a Google Sheets to your Google Docs document? It is very easy to do and can make your documents more informative and organized. In this article, we'll show you a step-by-step procedure for how to insert a Google Sheets spreadsheet into your Google Docs document. Let’s get started for the same! Insert a Google Sheets into a Google Docs How to Embed a Google Sheet into a Google DocInsert Google Sheet Table into Google DocInsert Excel Sheet into Google DocHow to Insert a Chart from Google SheetConclusion FAQs - How to Embed a Google Sheet into a Google DocHow to Embed a Google Sheet into a Google DocDiscover the easy steps to integrate data from Google Sheets into your Google Docs. This guide will show you how to seamlessly link your spreadsheets. Step 1: Open Both suits Open both the Google Sheet where your data is and the Google Doc where you want to put the data. Step 2: Highlight the data Highlight the data you want in the Sheet, then choose Edit > Copy or use your keyboard shortcut. Step 3: Click where you want the table in Google DocIn your Google Doc, click where you want the table, and select Edit > Paste. Step 4: Paste the table while choosin
Read More

How to Add Bullet Points in Google Sheets

article_img
Insert Bullets Into Google SheetsSelect the Cell to Insert Bullet PointPress F2 to enter Edit mode.Press ALT + 7 to enter a bullet into the cell.Add Text in the CellAre you ready to take your Google Sheets skills to the next level? Whether you're a spreadsheet novice or a seasoned pro, there's always something new to learn that can enhance your productivity. Bullet points are a great way to organize your data, create lists, or highlight important information in your spreadsheet. However, unlike Google Docs or Google Slides, Google Sheets does not have a built-in button for inserting bullet points. In this guide, we'll unravel the mystery of creating those neat, attention-grabbing bullet points that can transform your data presentation. Get ready to unlock a whole new level of clarity and professionalism in your spreadsheets as we walk you through various methods to elegantly incorporate bullet points into your Google Sheets documents. Different Ways to Add Bullet Points in Google Sheets There are four ways to add bullet points to Google Sheets:Copy-pasting the Bullet pointsUsing Keyboard ShortcutUsing CHAR functionUsing Custom Number FormatsHow to Insert Bullet Points Using the Spe
Read More

How to Change Cell Height and Width in Google Sheets

article_img
Are you tired of struggling with cramped, hard-to-read data in your Google Sheets documents? Whether you're a seasoned spreadsheet pro or a newcomer to the world of data management, one of the essential skills you need to master is the art of resizing cells. With the power to control row heights and column widths at your fingertips, you can transform your Google Sheets from cluttered chaos into a clean and organized masterpiece. In this guide, we'll show you the ropes on how to change cell size in Google Sheets, unlocking the potential to present your data with clarity, style, and precision. So, let's embark on this journey to create spreadsheets that not only crunch numbers but also convey your message effectively and aesthetically. Why to Change Cell Size in Google SheetsBy default, each cell of a Google spreadsheet is of the same size. You can write long words, or even sentences in these cells, but in that case, the content hides away or displays above the other cells as displayed in the below image. There is nothing wrong in entering data in a Google sheet like this but does this look good? Not really! This not only makes the sheet look cluttered but also reduces efficiency whi
Read More

How to Add Borders in Google Sheets

article_img
How to Add Borders in Google Sheets - Quick StepsOpen Google SheetsSelect dataSelect BorderSelect Border Style >> Click "Apply" Ready to level up your Google Sheets game? Adding borders isn't just about looks – it's a neat way to organize and highlight your data. Imagine your info neatly framed and sections clearly defined. In this guide, we'll show you how to easily add borders in Google Sheets. No more boring spreadsheets – let's make your data pop and your Sheets look sleek! Time to add a touch of style to your numbers! So, in this article, we will explore how we can add borders to a Google Sheet in easy steps. What are borders in Google Sheets? Border in Google Sheets is not a complicated thing it is just an action or feature in Google Sheets that is used to make the paragraph or an image attractive. We generally use borders to visualize our content and make it more representable. You can use a border and then customize it according to your choice. Why use borders in Google Sheets We use borders in Google Sheets for many reasons such as Table Organization in which you can add a border to the table to highlight important sections and borders are also used for emphasis and
Read More

How to Add Date and Time in Google Sheets

article_img
How to Add Time in Google Sheets- Quick StepsOpen your Google Sheets document.Click on the cell where you want to insert the time.Type the time in the desired format (e.g., 3:30 PM).Press Enter, and the time will be inserted into the cell.Time management is crucial, both in daily life and in spreadsheet mastery. In the dynamic world of spreadsheet management, Google Sheets stands out as a powerful tool for data manipulation and analysis. While basic arithmetic operations are straightforward to perform, dealing with date and time can be a bit tricky. How to Insert Date and Time in Google SheetsStep 1: Open Google Sheets and Select CellOpen your Google Sheets and select the cell where you want to begin by entering the date and time. Note: Date and time formats depend on the default locale of your spreadsheet , so make sure to change it before you begin .To change it, go to File > Settings. You will see a pop-up window where you can set your region under the General tab > Locale , a drop down menu pops up , select your region . This step will ensure those date and time formats you're accustomed to.  Select your Region and Click on Save Settings Step 2: Select a MethodThere are t
Read More

How to Use Smart Chips in Google Docs and Sheets

article_img
Google smart chips are little bits of data that can enhance your Google experience by retrieving data from other apps and services. Updated frequently, they offer more information about other users, files, maps, and more to Google Docs and Sheets. What Are Google Smart ChipsYou can add "Smart Chips," which are short pieces of information that, when clicked on, show more information in Google Docs and Google Sheets. Smart Chips let you get more information and do things when you pick them or move your mouse over them. Depending on the information you wish to incorporate, you can select from several different kinds of Smart Chips: Types of Smart ChipsPeopleGives you the option to add or modify a contact, send a message, make a video chat, view the person's email address, and more in Gmail. Google Contacts now has an option to open the detailed view in a separate tab in your browser. FilesHighlights the file's owner, a small preview with the ability to open a larger one (if appropriate), the link to the file in the relevant Google app or Google Drive, and the option to share the file. EventsBring up the meeting's data from Google Calendar, including the time, date, and title. You can
Read More

Clear Cell Content in Google Sheets - Quick Ways

article_img
Maintaining clean and organized spreadsheets is essential for efficient data analysis and presentation. Google Sheets offers several ways to clear cell content, catering to different needs and preferences. Here are the three best methods: How to Clear the Content of Single Cells in Google Sheets Inputting or noticing the incorrect value in a cell is common while working on a Google Sheets file. The content can be easily cleared if it is just one cell. These steps will help you do that: Step 1: Open Google's web browser and click on Sheets Open your default Chrome browser on your desktop and search for Google's home page. Click the 9 dots menu bar in the top right corner and select the "Sheets" option.   Step 2: Open the spreadsheet From the spreadsheet's home tab, open the sheet you want to work on and clear the cell's content. Step 3: Select the cell filled with content or data On your spreadsheet, click on the cell from which you want to clear your data and Tap on the Delete or Backspace keys. Now, the content of the cell is removed and erased. How to Clear Cell Content Using Delete Values Suppose you've ever tried to clear cell contents in Google Sheets by deleting an entire row
Read More

How to Open a CSV File in Google Sheets

article_img
Ever received a data dump in a mysterious file format called CSV? Don't worry, it's not an alien language! CSV stands for "Comma-Separated Values," and it's a common way to store data in rows and columns. But how do you unlock this treasure trove of information? Fear not, data warrior! This guide will show you how to effortlessly open a CSV file in Google Sheets, transforming those cryptic commas into a clear and organized spreadsheet in just a few clicks. Get ready to transform your data from chaos to clarity! What is a CSV FileGoogle Sheets CSV File where CSV stands for Comma Separate Value which is a text file format that uses commas to separate the data in it. CSVs are used to exchange data between applications, and you will usually find them in spreadsheets and databases. Although the data in CSVs is stored in the tabular form which means it has a column and some data in it. The main reason for using CSVs in applications is they can be created easily and also be opened in any program. How to Import CSV to Google Sheets AutomaticallyStep 1: Open Google SheetsOpen Google Sheets on your computer by going through any of your web browsers. Step 2: Click on "File Picker"After openin
Read More