Creating Date from Year & Month Values

acool

Board Regular
Joined
Feb 10, 2023
Messages
107
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I am currently trying to create a formula which provides a date output based on the year and month provided. In instances where I am provided year & month, I would like an output value that provides a value that illustrates the the first day of the month for that respective month & year. Attaching an image below for what I am trying to accomplish. In this instance I am provided column A & B, and would like to get to the output in Column C. Any help would be greatly appreciated. Thank You!



1685107743524.png
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Put this formula in cell C2 and format result as date:
Excel Formula:
=DATEVALUE(B2 & " 1, " & A2)
 
Upvote 0
Put this formula in cell C2 and format result as date:
Excel Formula:
=DATEVALUE(B2 & " 1, " & A2)
Hi Joe,

Thanks for your feedback. After trying this formula, I am still getting a value error in Cell C2. Not sure why it is giving me this error.


1685108395307.png
 
Upvote 0
Hi Joe,

Thanks for your feedback. After trying this formula, I am still getting a value error in Cell C2. Not sure why it is giving me this error.


View attachment 92375
I am guessing that you are probably using a European version of Excel then, right? It works in the US, but I believe there is a different default date format for the European settings. I will have to see if I can find out what that is.
 
Upvote 0
Does this one work?
Excel Formula:
=DATEVALUE("01-" & B2 & "-" & A2)
 
Upvote 0
Solution
I am guessing that you are probably using a European version of Excel then, right? It works in the US, but I believe there is a different default date format for the European
Does this one work?
Excel Formula:
=DATEVALUE("01-" & B2 & "-" & A2)
This did the trick! What is the difference in the formula? Why does one work vs. the other? Curious to understand.
 
Upvote 0
The difference, as I mentioned previously is in the default regional settings for your version of Excel.
Here in the US, "May 1, 2021" is recognized as an acceptable date format.
But it apparently doesn't work on your version.
So I tried "01-May-2021" (I thought I had seen that at one time for European versions), and it seems to have worked.

Also, when marking posts as the solution, please mark the initial post that contains the solution (not your own post acknowledging that some other post contains the solution).
I have updated this for you.
 
Upvote 0
The difference, as I mentioned previously is in the default regional settings for your version of Excel.
Here in the US, "May 1, 2021" is recognized as an acceptable date format.
But it apparently doesn't work on your version.
So I tried "01-May-2021" (I thought I had seen that at one time for European versions), and it seems to have worked.

Also, when marking posts as the solution, please mark the initial post that contains the solution (not your own post acknowledging that some other post contains the solution).
I have updated this for you.
Ok, thank you
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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