How to Use Excel IF Formula to Choose a Value from Two Columns
Question details
The user needs to return a value from either column J or column G based on whether the corresponding cell in column K contains "Yes" or "No".

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Attempting to conditionally extract data from alternating columns based on a text condition in a third column.
- Observed behavior
- Using the SUMIFS formula produces an argument error because it is overly complicated and not designed to toggle between two distinct return columns row-by-row.
Identify the columns containing your target values and the column containing your text condition before writing the formula. Ensure your conditional text (such as 'Yes' or 'No') exactly matches the data in your spreadsheet without extra trailing spaces.
Use a Standard IF Formula for Row-by-Row Selection
This is the most straightforward method to return a value from one of two columns based on a specific text condition in the same row.
The IF function evaluates a logical test and returns one value if true, and another if false. It is much better suited for this task than SUMIFS, which requires ranges of matching sizes and is designed for conditional summing rather than selective data extraction.
Click on the cell where you want the conditional result to appear (for example, cell L3).
Type the formula =IF(K3="Yes", J3, G3) into the formula bar. This checks if the value in K3 is exactly "Yes". If it is, the formula outputs the value from J3; otherwise, it defaults to the value in G3.
Press Enter to apply the formula. Then, click the bottom-right corner of the cell (the fill handle) and drag it down to copy the formula to the remaining rows in your dataset.

Calculate a Running Total Based on a Condition
Use this method if you do not just want the row's value, but instead need to calculate a cumulative sum of the selected values as you go down the spreadsheet.
Master Complex Formulas Easily with WPS Spreadsheet
WPS Spreadsheet provides robust, error-free support for all logical functions including IF, IFS, and SUMIFS. Its intuitive interface and built-in formula wizard make resolving argument errors and managing complex conditional data incredibly simple.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your conditional data.
- 2. Use the Function Wizard: Click the 'fx' button next to the formula bar to open the function wizard. Search for 'IF' and select it.
- 3. Fill in the arguments: Use the guided dialog boxes to input K3="Yes" for the Logical test, J3 for Value_if_true, and G3 for Value_if_false, then click OK to instantly apply it without syntax errors.

Frequently Asked Questions
Why does SUMIFS give an argument error in this scenario?
SUMIFS is designed to sum a single continuous range based on specific criteria. It cannot toggle between two different sum columns row-by-row based on a condition. An IF statement is the correct function for choosing between distinct columns.
Can I use multiple conditions to choose which column to pull from?
Yes, you can use the IFS function or nest multiple IF functions. For example, =IF(K3="Yes", J3, IF(K3="Maybe", H3, G3)) evaluates multiple scenarios and returns the corresponding column's value.
What if my condition column has more values than just 'Yes' and 'No'?
The formula =IF(K3="Yes", J3, G3) assumes anything that is not 'Yes' will default to the G column. If K3 might contain blanks or other words and you strictly want G3 only when the cell says 'No', you should use a nested formula: =IF(K3="Yes", J3, IF(K3="No", G3, "")).




