excel - Invert day and month from a date value if condition is met -
i have following 2 date columns in excel:
a b dd-mm-yyyy dd-mm-yyyy hh:mm
if day value , month value of 2 columns don't match, , month of b column matches day of column , day of b column matches month of column, have invert day , month values of b column.
for example, if have:
a b 04-10-2016 10-04-2016 22:10
i need vba turns into:
a b 04-10-2016 04-10-2016 22:10
i like:
for j=1 range("a1").end(xldown).row if extractdate(cells(j, 2)) <> cells(j, 1) , extractmonth(cells(j, 2)) = extractday(cells(j, 1) , extractday(cells(j, 2)) = extractmonth(cells(j, 1) invertdayandmonth(cells(j, 2) end if next j
i know functions don't exist, can me out that?
no real need perform check. if date in column guaranteed accurate, need column b time part.
extract time part column b , add date part of column a. put result need it.
Comments
Post a Comment