Rick
Rick

Reputation: 2308

Get date from cell and place in another cell formatted

I have a date field in cell N13 in the format "mm/dd/yyyy". and I am trying to concatenate this date as a file name in cell A1. To simplify, let's just put the the date in the following format in cell A1 "mm-dd-yyyy".

I have tried the following formula but get a #NAME? error: =Format(N13, "mm-dd-yyyy")

Upvotes: 0

Views: 60

Answers (2)

pnuts
pnuts

Reputation: 59450

Please try:

=TEXT(N13,"mm-dd-yyyy")

Upvotes: 1

Rick
Rick

Reputation: 2308

I noticed that I was mixing VBA with Excel functions, so I came up with the following

=IF(MONTH(N13)<10,0&MONTH(N13),MONTH(N13)) & "-" & IF(DAY(N13) < 10,0 & DAY(N13),DAY(N13)) & "-" & YEAR(N13)

Upvotes: 0

Related Questions