How to convert US (MM/DD) to UK (DD/MM) date format in Excel?

The system at work is using US date format and whenever I export any data into excel I have faced challenges since Excel does not know how to treat date column if it’s entered in different format.

Hence I have sourced only a rather simple solution – read below.

Image

Insert US date format values in Column A and in Column B you will get respective UK date format values. Drag cells down to as many as need.

Formula for cell B2:

=IF(A2=””,””,IFERROR(IF(CELL(“prefix”,A2)=”‘”,DAY(A2)&”/”&MONTH(A2)&”/”&YEAR(A2),MONTH(A2)&”/”&DAY(A2)&”/”&YEAR(A2)),DATE(RIGHT(A2,4),LEFT(A2,2),MID(A2,4,2))))

Hope this helps!

Need a longer than standard length macro and with ‘if this then that’ conditions?

Image

If you have ever tried to record a macro only to later discover that you’re getting ‘macro too long’ error message, you should consider to split a big macro project more that 1,400 lines) into several parts. ¬†Once you record separate macros (or, alternatively, you can record the whole thing and later cut it manually in code into several macros – requires more than just a very basic skills and so not recommended for novices) you need to make a new macro which will ‘call’ part A, B, C etc. one after another to execute the full project.

In below example you can see visual basic command ‘call’ + [macro name] repeating several times – this runs each macro within the bigger picture. I have also used ‘If’ condition – you can set the criteria in the master macro file (xlsm – macro enable spreadsheet) and then using the drop down menu use your own way to customise your report.

See the example code below.

Sub Big Project()
'
' Big Project Macro
'
'
If Range("l16").Value = "Yes" Then
 Call Project_Presorting
End If
If Range("l12").Value = "Yes" Then
 Call Project_PartA
 Call Project _PartB
End If
If Range("l12").Value = "No" Then (this condition excludes option of running macro called Project_PartB)
 Call Project_PartA
End If
If Range("l18").Value = "Yes" Then
 Call Project_Part C
End If
End Sub

Renars