Computer Learning Zone CLZ Access Excel Word Windows

There are no shortcuts - everything is reps, reps, reps.

-Arnold Schwarzenegger
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Excel Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Merge Text & YYYYMMDD
Keiron 

16 years ago
Hi Richard,
I'd appreciate your expertise. I cannot nail the formula to
join a text string in cell A1 with a date format of YYYYMMDD in B1. Currently,I get an 'internal' number of sorts.  Cheers
 


Answer from Richard Rost:


This is a tricky one. If you had a text value like "abc" in cell A1 and then a date value like "5/1/2010" in B1, you could just use this formula to concatenate them:

=A1&YEAR(B1)&MONTH(B1)&DAY(B1)

However, you're going to only see 1-digit months and days where applicable, like:

abc201051

So now you're going to have to throw in an IF function to add an extra zero in there. I'll put this in cell C1:

=IF(MONTH(B1)<10,"0"&MONTH(B1),MONTH(B1))

Likewise for D1:

=IF(DAY(B1)<10,"0"&DAY(B1),DAY(B1))

This will give me values like 05 for the month and 01 for the date, if the result is a single digit. Now, I can add it all together:

=A1&YEAR(B1)&C1&D1

This gives me:

abc20100501

Hope this helps. Here are a couple of tutorials that will better explain some of the concepts in this answer:

http://www.599cd.com/tips/excel/misc/if-function-sales-tax.asp?key=BlFAlEx

http://599cd.com/tips/excel/complex-if-example?key=BlFAlEx

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Excel Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/18/2026 7:05:37 AM. PLT: 0s