Need a modified formula...

JLouis

Active Member
Joined
Jan 1, 2004
Messages
295
Office Version
  1. 365
Platform
  1. Windows
I got the formula below from the board via a question. Never understood how it worked and now it returns a #VALUE.

=MID(B5,MIN(IFERROR(FIND({0,1,2,3,4,5,6,7,8,9},B5,1),LEN(B5)+1)),LOOKUP(1,0/MID(B5,ROW(INDIRECT("1:"&LEN(B5))),1),ROW(INDIRECT("1:"&LEN(B5)))) + 1 - MIN(IFERROR(FIND({0,1,2,3,4,5,6,7,8,9},B5,1),LEN(B5)+1)))

This formula extracts a date from the following entry: Date: 1/7/2020. The above formula returns 1/7/202 so when it is referenced in another sheet I get the #VALUE error referenced above.

I can use =right(b5,9) to return the correct date, but I'm concerned when the month goes to 2 digits it will not work again.

How do I modify the above formula to return the correct date in all circumstances?

Thanks in advance.

Louis
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
If "Date: " is before each date, you could use this: =RIGHT(B5,LEN(B5)-FIND(" ",B5))
 
Upvote 0
We were on the same page. I found that =REPLACE(B5,1,5,"") works as well. I'll have to see how it ages. Thank you for the reply.
 
Upvote 0
It depends on what you really want the date to be (text or a date). For example: Date: 01/07/2020 would return 01/07/2020, but if you put a 1* in front of the formula, you'll get 1/7/2020 which you could format as a date in a style of your choosing.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,547
Members
449,089
Latest member
davidcom

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