Date Wrong from PDF to Excedl

redfishman

New Member
Joined
Jul 25, 2008
Messages
9
When converting PDF to Excel, the dates show up in the formula bar as dd/mm/yyyy but show in the cell ( which is corrrect) as mm/dd/yyyy. This only happens if the middle number is less than 12. As example 02/12/2020 will show in formula bar as 12/2/2020. And if I format as mm/dd/yy it gives wrong date as 12/2/2020. How do I fix that?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
1. What is the date format in PDF? dd/mm/yyyy?
2. What is the date format on your local setting? dd/mm/yyyy?
3. Could you give more example, showing both the wrong & correct result?
 
Upvote 0
See PDF and the Conversion to Excel using PDF. My Adobe Acrobat X Pro is what I have for my PDF. See as example Incidents 17668816 & 60888816. Both of these have middle numbers of 12 or less. Click on the date of one of these and look at the formula bar. It has transposed the middle number to the front. Then format one of these to shorten the YYYY to YY and it shows as "Armenian", not US
TEST TEST pdf cho report.xlsx
ABCDEF
1Incident#CodeShort DescriptionDateTimeAddress
211021181914Destruction damage vandalism08/24/201921:0012803 NORTHBOROUGH DR
312027241914Destruction damage vandalism09/14/201910:0012803 NORTHBOROUGH DR
415696151914Destruction damage vandalism11/28/201920:3612803 NORTHBOROUGH DR
51712607190Murder non-negligent12/29/20190:0012803 NORTHBOROUGH DR
61713369193Robbery12/29/20196:0012803 NORTHBOROUGH DR
71592775194Aggravated Assault12/03/201921:0012803 NORTHBOROUGH DR
81688779194Aggravated Assault12/23/201916:0012803 NORTHBOROUGH DR
91766881614Criminal Mischief (Auto) > $1500 Loss02/09/20166:0012803 NORTHBOROUGH DR
105301571614Criminal Mischief (Auto) < $1500 Loss04/26/201613:0012803 NORTHBOROUGH DR
115896401614Criminal Mischief (Habitation) < $150005/08/201622:0012803 NORTHBOROUGH DR
126088881614Criminal Mischief (Habitation) < $150005/12/201620:0012803 NORTHBOROUGH DR
136058301614Criminal Mischief (Unclassified) < $150005/12/20168:0012803 NORTHBOROUGH DR
146738861614Criminal Mischief (Auto) < $1500 Loss05/26/201613:0012803 NORTHBOROUGH DR
157651021614Criminal Mischief (Habitation) < $150006/14/201616:0012803 NORTHBOROUGH DR
1680549166Theft - From Building or Habitation01/19/201618:0012803 NORTHBOROUGH DR
178306901614Criminal Mischief (Habitation) < $150006/28/201611:0012803 NORTHBOROUGH DR
18170486166Theft - All Other Items (Miscellaneous)02/08/201617:0012803 NORTHBOROUGH DR
198316821614Criminal Mischief (Habitation) < $150006/28/201615:0012803 NORTHBOROUGH DR
20211444166Theft - All Other Items (Miscellaneous)02/17/201617:0012803 NORTHBOROUGH DR
219296941614Criminal Mischief (Habitation) < $150007/19/20167:0012803 NORTHBOROUGH DR
22359510166Burglary Motor Vehicle (Contents/Not-Part)03/20/201622:0012803 NORTHBOROUGH DR
2310079141614Criminal Mischief (Auto) < $1500 Loss08/02/201619:0012803 NORTHBOROUGH DR
2410610511614Criminal Mischief (Auto) < $1500 Loss08/18/201623:0012803 NORTHBOROUGH DR
25456710166Burglary Motor Vehicle (Contents/Not-Part)04/09/201613:0012803 NORTHBOROUGH DR
2611009991614Criminal Mischief (Auto) < $1500 Loss08/27/201622:0012803 NORTHBOROUGH DR
2711132821614Criminal Mischief (Habitation) > $150008/30/201618:0012803 NORTHBOROUGH DR
2811143851614Criminal Mischief (Auto) < $1500 Loss08/31/20160:0012803 NORTHBOROUGH DR
29648862166Burglary Motor Vehicle (Contents/Not-Part)05/21/20169:0012803 NORTHBOROUGH DR
3011386971614Criminal Mischief (Habitation) < $150009/05/201612:0012803 NORTHBOROUGH DR
311536798178Simple Assault12/07/20170:0012803 NORTHBOROUGH DR
32802367166Theft - All Other Items (Miscellaneous)06/21/201613:0012803 NORTHBOROUGH DR
3315083051614Criminal Mischief (Auto) < $1500 Loss11/26/201612:0012803 NORTHBOROUGH DR
341536308178Simple Assault12/07/20170:0012803 NORTHBOROUGH DR
3516097241614Criminal Mischief (Habitation) < $150012/17/201620:0012803 NORTHBOROUGH DR
361117536166Theft - u.S. Mail08/24/201617:0012803 NORTHBOROUGH DR
3716044421614Criminal Mischief (Habitation) < $150012/18/201618:0012803 NORTHBOROUGH DR
381096187166Theft - All Other Items (Miscellaneous)08/25/201619:0012803 NORTHBOROUGH DR
3916078781614Criminal Mischief (Habitation) < $150012/19/201613:0012803 NORTHBOROUGH DR
4016159531614Criminal Mischief (Habitation) > $150012/20/20169:0012803 NORTHBOROUGH
411381477166Burglary Motor Vehicle (Contents/Not-Part)10/19/201614:0012803 NORTHBOROUGH DR
42638153175Burglary Habitation05/21/201716:0012803 NORTHBOROUGH DR
43816601814Vandalism01/20/20185:0012803 NORTHBOROUGH DR
441380339166Burglary Motor Vehicle (Contents/Not-Part)10/29/20168:0012803 NORTHBOROUGH DR
45642142178Assault - Class A/C by Bodily Force05/22/201718:0012803 NORTHBOROUGH DR
461524255178Simple Assault12/04/20170:0012803 NORTHBOROUGH DR
Table 1
 
Upvote 0
It looks like the date in PDF is dd-mm-yyyy but your local settings is mm-dd-yyyy.
See if this works:
If the middle number is < 13, then it will swap the day & month.
VBA Code:
Sub flipDate1a()
Dim x As String
Dim r As Range
Application.ScreenUpdating = False
For Each r In Range("D2", Cells(Rows.Count, "D").End(xlUp))
    x = r.Text
    If CLng(Mid(x, 4, 2)) < 13 Then r.Value = DateSerial(Right(x, 4), Left(x, 2), Mid(x, 4, 2))
Next
Application.ScreenUpdating = True

End Sub
 
Upvote 0
It looks like the date in PDF is dd-mm-yyyy but your local settings is mm-dd-yyyy.
See if this works:
If the middle number is < 13, then it will swap the day & month.
VBA Code:
Sub flipDate1a()
Dim x As String
Dim r As Range
Application.ScreenUpdating = False
For Each r In Range("D2", Cells(Rows.Count, "D").End(xlUp))
    x = r.Text
    If CLng(Mid(x, 4, 2)) < 13 Then r.Value = DateSerial(Right(x, 4), Left(x, 2), Mid(x, 4, 2))
Next
Application.ScreenUpdating = True

End Sub
Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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