web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to format as date ...
Power Apps
Unanswered

How to format as date when a number but text if not

(0) ShareShare
ReportReport
Posted on by 30

Hi guys, 

My app is reading from an excel spreadsheet and some of the data in a date column is listed as TBC or second half of 2023 while the majority is in date format. 

 

I was using the formula:

Text(ThisItem.Bronze, "dd/mm/yyyy", "en-GB")

To get the date showing right but obviously this isn't working for the mixed format data. 

 

I tried this, but it didnt work:

If(IsNumeric(ThisItem.Bronze),Text(ThisItem.Bronze, "dd/mm/yyyy", "en-GB"),Text(ThisItem.Bronze))

 

Any pointers?

 

Cheers

Categories:
I have the same question (0)
  • rswain Profile Picture
    173 on at
    You can modify your formula to use the DateValue function to convert the date strings to date values before applying the Text function to format them as dates. Here's an example:
    
    
    If(IsNumeric(ThisItem.Bronze), Text(DateValue(Text(ThisItem.Bronze, "[$-en-GB]dd/mm/yyyy")), "dd/mm/yyyy"), ThisItem.Bronze)
    
    This formula first uses the Text function to convert the date string to the date format "dd/mm/yyyy" using the en-GB locale. It then uses the DateValue function to convert the resulting string to a date value. If ThisItem.Bronze is not numeric, the formula simply returns ThisItem.Bronze as text without trying to convert it to a date.
  • freshtomatoes Profile Picture
    30 on at

    Thanks for your help @rswain, unfortunately that has given me an error on one location and then incorrect dates in another. 

     

    One set of dates looks like this:

    freshtomatoes_1-1680238931395.png

    despite the source dates looking like this:

    freshtomatoes_2-1680238959032.png

     

    The next table I used it in, does not show the dates but gives me this error:

    freshtomatoes_3-1680239001080.png

     

    Do you know what could be causing these issues?

     

    Cheers

     

     

  • Cat Schneider Profile Picture
    488 Most Valuable Professional on at

    Try using:

     

    Text(ThisItem.Bronze, "dd/mm/yyyy;@")

  • freshtomatoes Profile Picture
    30 on at

    Thanks @Cat , 

    That doesn't seem to work either, I get the following error:

    freshtomatoes_0-1680477800786.png

     

    And it shows like this: (there should be TBCs in the Bronze columns that don't have dates)

    freshtomatoes_1-1680477964571.png

     

     

  • Cat Schneider Profile Picture
    488 Most Valuable Professional on at

    Hmm... perhaps then if the first thing you used was working for your dates, and not the others,  try: 

     

    IfError(Text(ThisItem.Bronze, "dd/mm/yyyy", "en-GB"), ThisItem.Bronze)

  • freshtomatoes Profile Picture
    30 on at

    Thanks @CatSchneider but that doesn't seem to work either. That gives me the same error and stops showing the non-numbers. 

     

    freshtomatoes_1-1680501154361.png

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard