Function Problems

How to Convert Relative Text (Like 3 Years Ago) to an Excel Date

Natalie TaylorNatalie Taylor Nov 10, 2026 868 views

Question details

The user needs to translate relative date descriptions stored as text (e.g., 'a year ago', 'three months ago', 'two weeks ago') into actual date values formatted as mm/yy.

How to Convert Relative Text Dates into Excel Dates
Product
Excel
Device & OS
not provided
Scenario
Standardizing raw data or survey logs where respondents or systems inputted time relatively instead of using absolute calendar dates.
Observed behavior
The data is currently formatted as unstructured text strings, preventing proper chronological sorting or timeline-based mathematical calculations.
Before you start

Ensure your relative date text follows a predictable structure, usually containing a number or article (like '3' or 'a') followed by a time unit ('weeks', 'months', 'years') so that extraction formulas can accurately parse the values.

Solution 1Recommended

Use LET and EDATE Formula for Dynamic Text Extraction

This advanced formula dynamically searches for the time unit keyword within your text and subtracts the exact amount of weeks, months, or years from today's date.

By combining the LET function with SEARCH and EDATE, you can evaluate the entire string in one clean formula. The formula calculates the numeric offset and applies it directly to the current date.

1
Select a destination cell

Click on an empty cell next to your relative text string (for example, if your text is in A1, click B1).

2
Enter the LET formula

Type the following formula: =LET(period,SUM(ISNUMBER(SEARCH({"week","month","year"},A1))*{0,-1,-12}), amount,IFERROR(--LEFT(A1,FIND(" ",A1)-1),1), IF(period=0,TODAY()-7*amount,EDATE(TODAY(),amount*period))) and press Enter. This will output a numerical date serial number.

3
Format as mm/yy

Right-click the cell and select 'Format Cells'. Go to the 'Number' tab, choose 'Custom' from the category list, type 'mm/yy' in the Type box, and click OK.

Formatting Tip: Keeping the underlying value as a real date while changing the visual format to 'mm/yy' ensures you can still use the cell for future mathematical operations.
Data Processing Made Simple

Easily Handle Complex Formulas with WPS Spreadsheet

WPS Spreadsheet fully supports advanced array functions like LET, EDATE, and SEARCH, allowing you to clean and transform complex text strings into actionable dates effortlessly. The intuitive interface helps you spot formula errors quickly.

  1. 1. Open your data in WPS Spreadsheet: Launch WPS Office, open the Spreadsheet module, and load the file containing your relative date texts.
  2. 2. Paste the formula: Click into an adjacent cell and paste the dynamic LET formula provided in the solution.
  3. 3. Format seamlessly: Use the shortcut Ctrl+1 to open the Format Cells dialog, select Custom, and apply your desired 'mm/yy' format.
100% compatibility with Microsoft Excel formulas and Custom Number formatting.Advanced function library including LET, TEXTBEFORE, and TEXTAFTER available out of the box.Free to download and lightweight on your system resources.Built-in data cleaning tools to simplify complex spreadsheet tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can I format the output to show the full date instead of just month and year?

Yes. If you used the LET formula, simply right-click the cell, open 'Format Cells', choose the 'Date' category, and select a full date format (like 'dd/mm/yyyy') instead of 'mm/yy'.

Why does my formula return a #NAME? error?

A #NAME? error usually means your spreadsheet version does not support one of the functions used, such as LET, TEXTBEFORE, or TEXTAFTER. Updating to a newer version of WPS Office or Excel 365 will resolve this.

How do I modify the formula to account for 'days ago'?

To include days in the LET formula, add 'day' to the SEARCH array and corresponding offset: SEARCH({"day","week","month","year"},A1) and match it with offsets {0,0,-1,-12}. In the IF condition, calculate the day subtraction directly from TODAY().

Does the formula automatically adjust to the current date?

Yes. Because both formulas utilize the TODAY() function, the calculation will always be relative to the exact date you open or refresh the spreadsheet.