Need to build text from columns that includes Date columns

dntietz

New Member
Joined
Feb 25, 2011
Messages
2
Hi all.
I am trying to create a Text statement that includes several columns in a spreadsheet, formatted in a certain way, to build a SQL statement from each row in the spreadsheet.
I'm running into a problem converting Date columns into Dates as text in the text cell.
I'm using the Concatenate method - which works well for numeric and text cells.

Here is my example Formula where column W is the date - and W2 equals 20-Dec-2021 -- which is what I want in my cell.

="("&B2&",'"&C2&"','"&D2&"',,'"&E2&"','"&F2&"','"&G2&"','"&H2&"','"&I2&"','"&J2&"',' ',' ',' ',' ',' ',' ',"&Q2&",'"&R2&"',' ','"&T2&"','"&U2&"',"&V2&",'to_date("&W2&",'dd-MON-yyyy')',"

I can't get any value but this ridiculous 44550 !! what?
How do i convert it back to 20-Dec-2021 or anything like that? 12/20/2021 would be fine but no... i can't get anything but 44550.

Please HELP!
Thank you!!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi & welcome to MrExcel.
How about
Excel Formula:
="("&B2&",'"&C2&"','"&D2&"',,'"&E2&"','"&F2&"','"&G2&"','"&H2&"','"&I2&"','"&J2&"',' ',' ',' ',' ',' ',' ',"&Q2&",'"&R2&"',' ','"&T2&"','"&U2&"',"&V2&",'to_date("&TEXT(W2,"dd-mmm-yyyy")&",'dd-MON-yyyy')',"
 
Upvote 0
Solution
Thank you Fluff for your response!!
I got it working now!!!
Thank you SOOOOO Much!!

This is what I did...
..."&V2&",to_date("&TEXT(W2,"dd-mmm-yyyy")&",....
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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