Convert and merge Number and Date

elcentro3m

Board Regular
Joined
Jan 26, 2007
Messages
60
I want to merge a Year (general number format)

Ex: 2008 in cell $c$1

with a Date (01-Jan-09 format)

in cell A3

so that the end result is

Ex: 01-Jan-08

I'm using Excel 2007.

So far, what I'm finding either isn't relevant
or working.

Anyone?

Thanx
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I believe Jonmoe's will only work with January first.
Try this, where A3 holds your true DATE and C1 holds the year number:
Code:
=DATE(C1,MONTH(A3),DAY(A3))
 
Upvote 0
Hmm, I thought the OP meant that the RESULT would be in A3, and should be January 1st of whatever year is in C1.

I think you're probably right though...
 
Upvote 0
Thanx to both of you for your replies and suggestions.

Here's where I'm going with it:

This is David Seah's Compact Calendar:

http://davidseah.com/blog/comments/compact-calendar/

Credit to him.

I just thought it could do with some useful
mods.

Here's what I sent him (more comments
and translations at the link above)

If it's ok with David, I'll post my tweaked
version here. Otherwise, he may also
post my version and the link to it from his
page.

Still, even without my tweaked version, it
should be easy enough to follow my changes.

I added a few tweaks.

You can change the year but the Holidays
didn't automatically adjust. So, I, with
the help of the folks at MrExcel, figured
out a way to adjust the Holidays automatically
by plugging in the Year from the main Calendar
into the Holiday Dates. This way, when you
change to a new year, the Holidays update to,
and from the same location, so no having to
change each date every time you update.

Here's what I used for the Holiday dates:

=DATE(Calendar!$I$1,1,1)

(change as needed for each Holiday)

One other thing I did was to change the Year
to a drop down list (hidden on the Holidays page
in Columns D-H. It now goes all the way up to
2050. And beyond that, it's a simple matter to
simply update the numbers in the range.

The last thing that I haven't entirely figured out
yet is the whole Holiday Friday, or Monday, or
as in Thanksgiving, the Last Thursday of November.

Using the info from this page:

Calculate Last Sunday and First Sunday in the Month:

http://www.dslimited.biz/excel-zen/...te-last-sunday-and-first-sunday-in-month.html

I used his example to calculate (after setting
up pointer tables, also on the Holidays page
the Last Thursday of November for Thanksgiving.

Here's what I used (via some reference lists as suggested
in the link above) to calculate the Last Thursday in November:

= DATE(Calendar!$I$1, $E$12 + 1, 0) - MOD(WEEKDAY(DATE(Calendar!$I$1, $E$12 + 1, 0)) - 5, 7)

$E$12 is the pointer to the month number: 11

The Days (in this formula "5" = Thursday:

1 - Sun, 2 - Mon, etc

The link explains the process clearly and in such great detail
with numerous examples.

It should also be easy then to calculate any other
1st, 2nd, 3rd, last etc special dates.

Hope this proves useful.

Thanx
 
Upvote 0
You don't really need MOD in the formula for calculating days of the month. Here's a generic version

=DATE(y,m,1+n*7)-WEEKDAY(DATE(y,m,8-d))

where y = year, m =month n = occurrence in month, d = day of week (sun =1 to sat = 7)

Thanksgiving is the 4th Thursday in November, which isn't always the last the last, so translating that formula to calculate Thanksgiving for a variable year in A1

=DATE(A1,11,1+4*7)-WEEKDAY(DATE(A1,11,8-5))

which can be simplified further to

=DATE(A1,11,29)-WEEKDAY(DATE(A1,11,3))

Where you do need the last day of a month, i.e. Memorial Day which is the last Monday in May, you can just calculate the 1st Monday in June and subtract 7 so that would be

=DATE(A1,6,1)-WEEKDAY(DATE(A1,6,6))
 
Upvote 0
The link to my mods to David's Calendar
is now up at David's site (see earlier post
this thread for the link to David's Calendar
(under comments))

or here:

http://home.comcast.net/~mmeroom/CompactCalendar2009us-ms1.xltx

I've included Holiday info from John Walkenbach's
calendar, the info from barry on Date Calculation
and I've updated the Holiday Table to reflect
barry's formula. As well as all associated source
links.

Thanx all.
 
Upvote 0

Forum statistics

Threads
1,214,848
Messages
6,121,917
Members
449,055
Latest member
KB13

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