Google Sheets Formula: Add Values to Different Columns Based on Specific Criteria

Abstract: Use SUMIF to aggregate values in different columns based on specific criteria without manual entry.

Created: 2026-08-19 by
Use the SUMIF function to add values to different columns based on specific criteria by defining a range for the condition and a corresponding sum range. This approach allows you to aggregate data dynamically without manual entry, ensuring that only rows matching your specified criteria contribute to the total in each respective column.

Understanding the SUMIF Function Structure

The core of this solution lies in the SUMIF function, which is available in Google Sheets, Excel, and LibreOffice Calc. The syntax requires three distinct arguments: range, criteria, and sum_range. The range argument specifies the cells where you want to evaluate the criteria. The criteria argument defines the condition that determines which cells in the range will be added (such as "Apple", ">32", or "sum_range is optional but necessary when you want to sum different cells than those evaluated in the first argument. If omitted, the function sums the cells in the range itself. For example, if you have a list of sales in column A and their corresponding amounts in column B, and you want to sum only the sales for "Apples" found in column A, you would use the formula =SUMIF(A:A, "Apples", B:B). This tells the spreadsheet to look at every cell in column A, check if it equals "Apples", and if so, take the value from the same row in column B and add it to the total.

Implementing Criteria-Based Summation in Google Sheets

In Google Sheets, you can apply this logic to multiple columns by adjusting the ranges accordingly. Suppose you have a dataset with Product Names in Column A, Sales in Column B, and Returns in Column C. You might want to calculate the net sales for "Electronics" by subtracting returns from sales. While SUMIF handles simple addition, you can combine it with other functions for more complex scenarios. To get the total sales for Electronics, place the following formula in a cell:
=SUMIF(A:A, "Electronics", B:B)
To get the total returns for Electronics, use:
=SUMIF(A:A, "Electronics", C:C)
This method ensures that each column aggregates data independently based on the shared criterion in Column A. You can also use cell references for the criteria instead of hardcoding text. For instance, if cell E1 contains the product name "Electronics", you can use =SUMIF(A:A, E1, B:B). This makes your template dynamic; changing the value in E1 automatically updates the sum.

Adapting the Formula for Excel Users

Excel users can utilize the exact same SUMIF syntax as Google Sheets. The behavior is consistent across both platforms for basic single-criteria summation. However, Excel offers additional flexibility with SUMIFS if you need to apply multiple criteria. For example, if you wanted to sum sales only for "Electronics" sold in "Q1", you would use =SUMIFS(B:B, A:A, "Electronics", D:D, "Q1"). For users migrating from other systems, note that Excel's SUMPRODUCT function can also achieve similar results with array logic, though SUMIF is generally faster for large datasets. If you are looking to position criteria differently or handle two criteria positions, you might find relevant techniques in our guide on Excel XLOOKUP Formula: Positioning Criteria with Two Criteria. This resource details how to manage complex lookup scenarios that go beyond simple summation.

LibreOffice Calc Compatibility

LibreOffice Calc supports the SUMIF function natively, making it straightforward for users switching between applications. The syntax remains identical: SUMIF(range; criteria; [sum_range]). Note that LibreOffice often uses semicolons (;) as argument separators rather than commas (,), depending on regional settings. Ensure your formula reflects the separator used in your locale. If you encounter issues with table references in LibreOffice, such as transforming formula field references to table references, consult our article on Transforming Formula Field Reference to Table Reference in LibreOffice Calc. This can help ensure your ranges are correctly identified within structured tables, preventing errors when applying criteria-based formulas.

Handling Multiple Criteria with SUMIFS

When your criteria become more complex, requiring checks against multiple conditions, switch to the SUMIFS function. Unlike SUMIF, which accepts only one condition, SUMIFS allows for up to 127 pairs of range and criteria. The syntax is SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...). For example, to sum sales for "Electronics" in "Region A", use:
=SUMIFS(B:B, A:A, "Electronics", C:C, "Region A")
This ensures that both conditions must be met simultaneously for a value to be included in the sum. This is particularly useful when dealing with large datasets where a single criterion is not sufficient to isolate the desired data points.

Frequently Asked Questions

What happens if my criteria range has blank cells?

Blank cells in the criteria range are typically ignored by SUMIF unless the criteria explicitly accounts for blanks. If you need to treat blanks as zeros or include them in the count, consider using SUMPRODUCT or checking for empty strings in your criteria.

Can I use wildcards in my criteria?

Yes, you can use wildcards like the asterisk (*) for any sequence of characters or the question mark (?) for a single character. For example, "*App" will match "Apple", "Apples", and "Pineapple". Enclose the wildcard string in double quotes within the formula.

How do I sum values greater than a specific number?

You can use comparison operators directly in the criteria argument. For example, =SUMIF(B:B, ">100") will sum all values in column B that are greater than 100. Remember to enclose the operator and number in quotes.

Why is my SUMIF returning zero when I expect a value?

Check for hidden spaces or mismatched data types. Text numbers stored as actual numbers may not match if one is formatted as text. Use the TRIM function to remove extra spaces or convert text to numbers using VALUE() before applying the formula.

Is there a limit to the number of criteria I can use?

SUMIF is limited to one criterion. For multiple criteria, use SUMIFS, which supports up to 127 criterion pairs. If you exceed this limit, you may need to break down your calculation into multiple steps or use helper columns.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More