Function Problems

Excel Lookup for a Discount by Product and Date Range

Adam DavisAdam Davis Nov 18, 2026 869 views

Question details

Return a discount percentage when a product and purchase date match a season in a separate table.

Look Up a Discount in Excel by Product and Date Range
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.
Before you start

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.

Solution 1Recommended

Use XLOOKUP to match the product and season

Use this formula in Excel versions that support XLOOKUP, including Microsoft 365.

1
Check the discount table

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.

2
Enter the lookup formula

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.

3
Format and copy the result

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 XLOOKUP to match the product and season
Inclusive date range: The formula includes both the start and end dates. If more than one row matches, XLOOKUP returns the first matching discount.
Calculate discounts in WPS Spreadsheets

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. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and locate the purchase and discount tables.
  2. 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. 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. 4. Format and fill: Choose Percentage format on the Home tab and drag the result cell's fill handle down for the remaining purchases.
Match purchases against inclusive season datesReturn a blank when no discount row matchesOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interface for free
microsoft office alternative - wps office

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.