Excel Lookup for a Discount by Product and Date Range
Question details
Return a discount percentage when a product and purchase date match a season in a separate table.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A purchase record contains a product and date, while a discount table lists products, season start and end dates, and discount percentages.
- Observed behavior
- The lookup should return the matching discount when the purchase date falls within the season, or a blank when no row matches.
Check that purchase dates and season boundaries are stored as real dates, and that product names match between the two tables. The examples use A2 for the product and B2 for the purchase date.
Use XLOOKUP to match the product and season
Use this formula in Excel versions that support XLOOKUP, including Microsoft 365.
Select the discount table and confirm it is named DiscountTable, with columns named Product, Season Start Date, Season End Date, and Discount. Adjust the names in the formula if yours differ.
In the discount result cell, enter =IFERROR(XLOOKUP(1,(A2=DiscountTable[Product])*(B2>=DiscountTable[Season Start Date])*(B2<=DiscountTable[Season End Date]),DiscountTable[Discount]),"") and press Enter.
On the Home tab, select Percentage format for the result cell, then drag its fill handle down to apply the formula to other purchase rows.

Use INDEX and MATCH in older Excel versions
Use this alternative when XLOOKUP is unavailable.
Find seasonal discounts in WPS Spreadsheets
Use COUNTIFS and SUMIFS in WPS Spreadsheets to return a discount for a matching product and date range. This approach assumes that no two seasons overlap for the same product.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and locate the purchase and discount tables.
- 2. Check the source columns: Use A2 for the purchase product and B2 for its date. The example expects discount products in A12:A15, start dates in B12:B15, end dates in C12:C15, and discounts in D12:D15.
- 3. Enter the formula: Select the result cell and enter =IF(COUNTIFS($A$12:$A$15,A2,$B$12:$B$15,"<="&B2,$C$12:$C$15,">="&B2)=0,"",SUMIFS($D$12:$D$15,$A$12:$A$15,A2,$B$12:$B$15,"<="&B2,$C$12:$C$15,">="&B2)), then press Enter.
- 4. Format and fill: Choose Percentage format on the Home tab and drag the result cell's fill handle down for the remaining purchases.

Frequently Asked Questions
Does the lookup include the first and last day of the season?
Yes. The formulas use greater-than-or-equal and less-than-or-equal comparisons, so both boundary dates are included. If purchase cells contain times, remove the time or account for it in the comparison.
Why does the formula return a blank?
A blank means no row matched, or the formula encountered an error. Check the product spelling, confirm the dates are real date values, and verify that the referenced ranges or table column names are correct.
What happens if two seasons overlap for the same product?
The XLOOKUP and INDEX/MATCH formulas return the first matching row. The WPS SUMIFS formula adds all matching discounts, so use it only when seasons for the same product do not overlap.
Why do I need Ctrl+Shift+Enter for INDEX and MATCH?
Some older Excel versions require Ctrl+Shift+Enter to evaluate the multiple-condition formula as an array formula. Microsoft 365 and newer versions can normally evaluate it with Enter.




