Formula to Format Dates Without Converting to Text in Google Sheets

Can we format a date from “DD/MM/YYYY” to “DD-MMM-YYYY” or any other format using a formula without converting it to text in Google Sheets?

My answer is “Yes.” We can format a date using a formula while keeping the underlying date value in Google Sheets.

Your search for a formula to format dates usually leads to a solution using the TEXT function, right? But is there an alternative to the TEXT function in Google Sheets to format a date?

Yes! Let’s dive into that. But first, let’s explore why the TEXT function may not always be the best option.

The Issue with Using the TEXT Function to Format Dates

The TEXT function has a significant limitation that you may have already encountered. Let’s test that and explore further.

In the following example, we will use the TEXT function to format a date from “DD/MM/YYYY” to “DD-MMM-YYYY”:

  • Cell C2 contains the date 26/01/2023. It’s an original date in a recognizable date format. We can use the following formula in cell D2 to format this date:
=TEXT(C2, "DD-MMM-YYYY")

Now, let’s test the result of this formula.

Testing the Date Formatted Using the TEXT Function

We have our original date in cell C2 and the TEXT-formatted date in cell D2.

Here are the test results:

FormulaResultPassed/Failed
=ISDATE(D2)TRUE
=YEAR(D2)2023
=DATEVALUE(D2)44952
=DATE(2025,12,31)>D2FALSE

Notice the last formula, which returns FALSE instead of TRUE! Even though 31/12/2025 is greater than 26/01/2023, the formula returns FALSE.

You may face issues when using a TEXT-formatted date within functions such as ISBETWEEN, FILTER, etc., or wherever comparison operators are involved.

Here’s another example before we attempt to format a date using a formula for date formatting without text conversion.

Additional Example: Date Formatting Using TEXT

I’ve used =TEXT(C2, "DD-MMM-YYYY") in D2 and =TEXT(C3, "DD-MMM-YYYY") in D3 to format the dates in C2 and C3, respectively.

Formatted Date Using TEXT Function Not Recognized as a Date

Formula #1:

=FILTER(B2:B11, ISBETWEEN(A2:A11, D2, D3))

I expect it to return “E,” “F,” “G,” and “H”—the values in the highlighted cells.

However, using Formula #1, we get an #N/A error.

Now, here’s the correct formula using the original dates:

Formula #2:

=FILTER(B2:B11, ISBETWEEN(A2:A11, C2, C3))

This one works correctly because it uses the original date values.

Formatting a Date Using a Formula Without Converting it Into Text

Now, let’s talk about the solution.

We can format a date using a formula without converting it into text in Google Sheets. This can be done using the QUERY function and the FORMAT clause.

For example, in the case where Formula #1 returns #N/A, we can apply the QUERY function as follows:

  • In D2, enter:
    =QUERY(C2, "FORMAT C 'DD-MMM-YYYY'")
  • In D3, enter:
    =QUERY(C3, "FORMAT C 'DD-MMM-YYYY'")

This will correctly format the date while keeping the underlying date value intact.

The QUERY function allows us to format the date without converting it to text, and Formula #1 will now work correctly.

Formatting All Dates in Column A

What if you want to format all the dates in column A while keeping the underlying date values?

Here’s the formula for that:

=QUERY(A2:A, "FORMAT A 'DD-MMM-YYYY'")

This formula will format the entire column of dates without converting them into text.

Example of Formatting a Date Without Converting It to Text

Conclusion

In this post, we’ve learned how to use a formula for date formatting without text conversion in Google Sheets. By using the QUERY function with the FORMAT clause, you can format your dates in a custom way while maintaining their true date values, allowing you to use them effectively in further calculations or functions.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. With years of experience working with Google Sheets and Excel for multinational firms in Mumbai and Dubai, he has been blogging since 2012, offering practical, real-world spreadsheet solutions that professionals rely on. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

Count Consecutive Workday Absences in Google Sheets

This tutorial offers a powerful formula-based solution to count consecutive workday absences in Google...

More like this

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

Count Consecutive Workday Absences in Google Sheets

This tutorial offers a powerful formula-based solution to count consecutive workday absences in Google...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.