Show Shipping Cost Only Once for Duplicate Order Numbers in Excel
Question details
The user wants to display the shipping cost only on the first row of an order containing multiple product lines, and needs to replace the default "FALSE" output for subsequent duplicate rows with an empty string or zero.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating and displaying shipping costs for orders with multiple items, where the order number repeats across several rows.
- Observed behavior
- The current formula successfully identifies the first order row but returns "FALSE" for the duplicate rows instead of leaving them blank or outputting a zero.
Ensure your dataset is sorted by the order number column so that all rows belonging to a single order are grouped consecutively before applying any formulas.
Modify the Formula to Return a Blank String for Duplicates
Update your IF formula to output an empty string ("") for duplicate order numbers, which keeps the spreadsheet visually clean by hiding duplicate shipping values.
When an IF formula is missing the 'value_if_false' argument, Excel automatically returns FALSE. By explicitly defining this argument as an empty string, the duplicate rows will appear blank.
Locate your Order Number column (e.g., Column A) and your Shipping Cost column (e.g., Column B).
Select the first cell in your new shipping display column (e.g., C2) and enter the formula: =IF(COUNTIF($A$2:A2, A2)=1, B2, "").
Press Enter, click on cell C2, and double-click or drag the fill handle in the bottom-right corner to copy the formula down to the rest of your dataset.
Return Zero (0) for Downstream Calculations
If you plan to use direct mathematical operators on the shipping cost column later, returning a zero instead of a blank string prevents #VALUE! errors.
Handle Complex Data Formulas Seamlessly in WPS Spreadsheet
WPS Spreadsheet offers comprehensive support for logical functions like IF and COUNTIF, allowing you to manage duplicate order entries easily. It is an excellent choice for cleaning up and formatting your business data effortlessly.
- 1. Open your data in WPS: Launch WPS Spreadsheet and open your order data workbook.
- 2. Input the logical formula: Type your customized =IF(COUNTIF(...)) formula into the target cell to identify the first occurrence.
- 3. Apply across duplicates: Use the smart fill handle to apply the formula logic across all rows instantly.

Frequently Asked Questions
Why does my IF formula return FALSE instead of remaining blank?
If an IF function lacks the third argument ('value_if_false'), the software defaults to returning the logical value FALSE. Adding '""' or '0' at the end of the formula explicitly tells it what to display when the condition is not met.
Can I use the SUM function on a column that contains empty strings?
Yes, the standard SUM function automatically ignores text values, including empty strings (""). However, if you add cells directly using the plus sign (e.g., =A1+A2), an empty string will trigger a #VALUE! error.
Does the dataset need to be sorted for the COUNTIF duplicate formula to work?
The specific formula =IF(COUNTIF($A$2:A2, A2)=1, ...) counts occurrences cumulatively from the top down. While it technically identifies the first occurrence regardless of order, sorting by the order number ensures that duplicate items are grouped together, which makes the data much easier to review.




