How to Use Excel IF and VLOOKUP Formulas for Date-Based Amounts
Question details
The user needs a reliable formula setup to automatically return varying amounts and descriptive messages depending on specific date ranges.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Assigning conditional numerical amounts and corresponding text labels (such as financial year levies) based on where a specific date falls within a set timeline.
- Observed behavior
- The user requires an accurate formula syntax that handles chronological thresholds correctly without manual data entry.
Ensure that your source dates are formatted as valid date serial numbers rather than plain text, as Excel requires true date values to accurately calculate greater-than or less-than logic.
Use an Approximate-Match VLOOKUP Table
Creating a dedicated lookup table is the most scalable and maintainable way to return different amounts and messages across multiple date ranges.
Approximate-match lookup functions scan for the row with the latest starting date that is not later than your target date. This method requires your lookup table dates to be sorted in ascending order.
In an empty area of your spreadsheet, create a table with three columns: Starting Date, Amount, and Message. Sort the Starting Date column in ascending order. (Tip: Use 01/01/1900 in the first row for dates before your first real threshold).
Select the entire table (excluding headers) and name the range 'FYLevies' in the Name Box located to the left of the formula bar.
In your main data sheet, click the cell where you want the amount to appear. Enter the formula =VLOOKUP($A2, FYLevies, 2, TRUE), assuming A2 contains your target date.
In the adjacent cell where the message should appear, enter =VLOOKUP($A2, FYLevies, 3, TRUE) to pull the corresponding text from the third column of your lookup table.

Use a Nested IF and DATE Formula
If you only have a few date ranges and do not want to set up a separate table, a nested IF formula provides a self-contained solution.
Easily Handle Complex Formulas with WPS Spreadsheet
WPS Spreadsheet fully supports VLOOKUP, IF, and DATE functions natively, allowing you to manage date-based records, execute conditional logic, and categorize your data seamlessly. It provides a familiar, fast, and feature-rich environment for all your calculation needs.
- 1. Open your Spreadsheet: Launch WPS Office and open your .xlsx workbook in the WPS Spreadsheet application.
- 2. Insert the Formula: Select the target cell, type =VLOOKUP or =IF, and follow the on-screen formula tooltips to select your date ranges.
- 3. Drag to Apply: Use the fill handle to copy your newly created date-logic formulas across all necessary rows in your dataset.

Frequently Asked Questions
Why does my IF formula return an error or incorrect value for dates?
This usually happens when dates are typed as plain text strings (like "10/31/2023") within the formula, which Excel cannot evaluate mathematically. Always wrap your dates in the DATE() function (e.g., DATE(2023,10,31)) or reference a cell containing a valid date serial number.
Do I have to use TRUE in my VLOOKUP formula for date ranges?
Yes. Using TRUE (or omitting the fourth argument) sets the VLOOKUP to an 'approximate match'. It looks for the largest value that is less than or equal to your lookup value, which is exactly how date brackets are calculated. Using FALSE would only return an amount if the date matches the threshold exactly.
Can I use XLOOKUP instead of VLOOKUP for this?
Yes. If your version of Excel or WPS Spreadsheet supports XLOOKUP, you can use it with the 'match_mode' argument set to -1 (exact match or next smaller item). This removes the strict requirement to sort your lookup table in ascending order, though sorting is still a best practice.
How can I return both the amount and the message in a single cell?
You can combine the results using the ampersand (&) operator. For example: =VLOOKUP($A2, FYLevies, 3, TRUE) & " " & VLOOKUP($A2, FYLevies, 2, TRUE). This will concatenate the message text and the amount into one continuous string.




