Function Problems

How to Sum Values When Either of Two Columns Matches a Criterion in Excel

Nimra MalikNimra Malik Nov 11, 2026 868 views

Question details

The user needs a spreadsheet formula to sum positive values in a specific column if either of two other columns contains a specific text code (implementing OR logic).

How to Sum Values When Either of Two Columns Matches a Criterion
Product
Excel
Device & OS
not provided
Scenario
Financial tracking or data analysis requiring conditional sums based on multiple columns with OR logic, while explicitly excluding zero and negative amounts.
Observed behavior
Standard SUMIF and SUMIFS functions natively use AND logic for multiple criteria, making it challenging to sum values based on an OR condition across two different columns.
Before you start

Ensure your data ranges are identical in size across all referenced columns to avoid formula calculation errors, and verify that your numerical column does not contain text formatted as numbers.

Solution 1Recommended

Use the SUM and FILTER Functions (Modern Approach)

This is the most efficient method for modern spreadsheet versions supporting dynamic arrays, as it handles complex AND/OR logic cleanly in a single formula.

By nesting the FILTER function inside the SUM function, you can use mathematical operators to create logical tests. The asterisk (*) acts as the AND operator, while the plus sign (+) acts as the OR operator.

1
Select the target cell

Click on the cell where you want the total calculated sum to appear.

2
Enter the SUM and FILTER formula

Type the formula: =SUM(FILTER('List of Transactions'!G3:G373,('List of Transactions'!G3:G373>0)*(('List of Transactions'!K3:K373="R")+('List of Transactions'!I3:I373="R"))))

3
Calculate the result

Press Enter. The formula will filter rows where column G is greater than 0 AND either column K OR column I contains 'R', and then sum the resulting values.

Use the SUM and FILTER Functions (Modern Approach)
Dynamic Range Tip: Converting your source range to an Excel Table (Ctrl+T) allows the formula to expand automatically as new transactions are added, so you won't need to manually adjust row numbers like G373.
Data Analysis Made Easy

Easily Handle Advanced Formulas with WPS Spreadsheet

WPS Spreadsheet fully supports modern array functions like SUM and FILTER, making it simple to process complex conditions and OR logic in your data. It provides a seamless alternative to Excel with complete formula compatibility.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open your financial or transaction data file.
  2. 2. Convert to Table: Select your data range and go to Insert > Table so your formulas auto-expand.
  3. 3. Apply the formula: Type your =SUM(FILTER(...)) formula into the target cell.
  4. 4. Calculate instantly: Press Enter to instantly view your conditionally summed data without needing complex array keystrokes.
Fully compatible with Microsoft Excel formulas and file formats (.xlsx)Free to use for daily data analysis and financial trackingNatively supports advanced dynamic arrays like FILTERLightweight application that runs smoothly on Windows, Mac, and Linux
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the standard SUMIF function work for OR logic?

The SUMIF and SUMIFS functions are designed to use AND logic when evaluating multiple criteria ranges. To evaluate OR logic across different columns, you must either combine multiple SUMIFS formulas with addition/subtraction or use array-capable functions like SUM with FILTER.

What does the plus sign (+) mean inside the FILTER function criteria?

In array formulas and the FILTER function, the plus sign (+) operates as a logical OR operator. It evaluates if the condition on the left side of the plus sign OR the condition on the right side is true.

How do I ensure my formula updates when I add new rows?

Convert your data into an Excel Table by selecting your data range and pressing Ctrl+T. When you reference table columns in your formula (e.g., Table1[Column1]), the ranges will automatically expand as new transactions are added to the bottom.