Make Formula into a UDF

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,180
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Is it possible to make this formula into a UDF. We pull data out of a system at least 3 times a week where the date comes out consistanly wrong. I would like to have a UDF so that it would be easier for myself and my collegues. Thanks in advance!


Book1
ABCD
1PPT DATE
224/03/20093/24/2009
329/05/20095/29/2009
421/05/20095/21/2009
59/6/20099/6/2009
628/05/20095/28/2009
720/05/20095/20/2009
819/05/20095/19/2009
97/5/20097/5/2009
1011/2/200911/2/2009
1112/5/200912/5/2009
1220/05/20095/20/2009
1322/04/20094/22/2009
146/3/20096/3/2009
1521/04/20094/21/2009
162/4/20092/4/2009
1720/05/20095/20/2009
185/6/20095/6/2009
196/5/20096/5/2009
Sheet1
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Honestly, a UDF wont' make it "easier"...
If anything, it's harder because you then have to ensure that macros are enabled.
Especially if the sheet is shared with multiple users...

If you already have a formula that works...stick with it.

If it can be done with a formula, then it probably should be done with a formula...
 
Upvote 0
Agreed.

You could also try selecting the dates, Data > Text to Columns, click Next twice, check Date, select MDY then click Finish.
 
Upvote 0
Or maybe a different formula, since yours doesn't exchange the month and day for dates that come across as valid:

=IF(ISTEXT(A2), --(MID(A2,4,2) & "/" &LEFT(A2,2) & "/" & RIGHT(A2,4)), DATE(YEAR(A2), DAY(A2), MONTH(A2)))
 
Upvote 0
Or maybe a different formula, since yours doesn't exchange the month and day for dates that come across as valid:

=IF(ISTEXT(A2), --(MID(A2,4,2) & "/" &LEFT(A2,2) & "/" & RIGHT(A2,4)), DATE(YEAR(A2), DAY(A2), MONTH(A2)))

I was on the assumption that the posted formula intentionally did not swap the month/day on dates that were already dates.
the dates that are already dates (say A5 - 09/06/2009) are already correct.
 
Upvote 0
That's possible, but it would be a strange program that output data in that fashion.
 
Upvote 0
Thanks fellows I figured that it would be pain and not worth it. shg the dates are messed up but that is the way that the program exports them. Thanks all!
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,282
Members
452,902
Latest member
Knuddeluff

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