Pulling My Hair out over stupidest and most simple formula

maximillianrg

Board Regular
Joined
Aug 7, 2014
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Cell J1 contains the following text: Remark: 02-JAN-2024 (CL):

Cell D1 contains this formula: =MID(" "&LEFT(TEXTAFTER(J1,"Remark"),18),FIND("-"," "&LEFT(TEXTAFTER(J1,"Remark"),18),1)-2,11)
Cell D1 Formula Results: 02-JAN-2024

Cell G1 contains this formula: =D1<=TODAY()
Cell G1 Formula Results: False

I am completely baffled as to why Cell G1 returns False rather than True?
If in cell D2 I put the formula: =D1+1 it returns 1/3/2024 so this tells me D1 is being treated like a real date but I am stumped
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The value in D1 is text, not a date.
Try
Excel Formula:
=--TEXTBEFORE(TEXTAFTER(J1," ")," ")
 
Upvote 0
Hello Fluff, Thank you for the fast reply. At first I was also thinking D1 was text, but if the formula in cell D2 is =D1+1 and the output is 1/3/2024, this tells me the contents of D1 is a number.
 
Upvote 0
No it's not a number. Both Mid & Textafter return text.
However if the text can be converted to a number it will be if you add 1.
 
Upvote 0
D1 is text.

The formula you're using to create the "value" in D1 creates a string, not a date/numeric value. When you add 1 to a date formatted as text (as in D1), Excel converts the text to its date value and then adds 1, giving you 1/3/2024.

When you simply compare the text in D1 to an actual date value (which is what is returned from the TODAY() function), you're comparing apples to oranges. No conversion of text-to-datevalue is occurring during the comparison.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top