Beginning and end of the month from year and month input excel - excel

I need guidance and help with an Excel question.
I am trying to automate a part of my salary slip.
I want the following , to always display the beginning of the month and end of the month.
"Period: 2018-02-01-2018-02-28"
For instance, if I have two cells in which I feed year: 2018 and month 02 or month 03 then , this should automatically update the : "Period: 2018-02-01-2018-02-28 or 2018-03-01-2018-03-31".
How can I do this?

I'm presuming that you need to do this with formula. If your year is in A1 and month in B1, type the below in C1
="Period: " & TEXT(DATE(A1,B1,"1"),"yyyy-mm-dd") & " " & TEXT(EOMONTH(DATE(A1,B1,"1"),0), "yyyy-mm-dd")
Now when you change the month in B1 (or year in A1), C1 will automatically update itself. Below is a screen shot of how it have it setup:

Try this ="Period: "&TEXT((DATE(B2,1,1)),"yyyy-mm-dd")&"-"&TEXT(EOMONTH(DATE(B2,1,1),C2-1),"yyyy-mm-dd")

Related

Excel macro to create date coloms

I just want to create list of months automatically between start and end dates in which if the starting date or the end date have only dates then it comes as date from to in excel.
If A1 contains the starting date, and A2 is the enddate, then
=TEXT(IF(EDATE($A$1,ROW() - 5) <= $A$2, EDATE($A$1,ROW() - 5), ""), "mmmyy")
does what you ask for. Just apply it for sufficiently many cells.

Calculate total work days in a month using the month name

I am trying to write a formula that will count all the work days in a month based on the month name. I am having a hard time trying to find information through Google on how to solve this without installing a 3rd party plugin, or writing it in VBA.
My table looks like this:
And the formula I am playing around with looks like this
=NETWORKDAYS.INTL(MONTH(A2),MONTH(A2),17)
Since it looks like the month name is a string Month(A2) will return an error. to get a date you will need to create a full string that Excel can use to return a date:
DATEVALUE("1 " & A2 & YEAR(TODAY()))
Using that and EOMONTH for the end date we get:
=NETWORKDAYS.INTL(DATEVALUE("1 " & A2 & YEAR(TODAY())),EOMONTH(DATEVALUE("1 " & A2 & YEAR(TODAY())),0),17)

Excel Date convert

I have date column like this
DEC07
SEP2007
SEP2008
JUN10
JUN09
how can I can convert this into MM/YYYY assuming DEC07 is 12/2007?
With data in A1, in B1 enter:
=MONTH(DATEVALUE("1 " & LEFT(A1,3) & " 2000")) & "/" & IF(LEN(A1)=5,2000+RIGHT(A2,2),RIGHT(A1,4))
and copy down.
The formula will handle both 2-digit years and 4-digit years.
This converts it to an actual date and not a string that looks like a date:
=IF(LEN(A1)=5,--REPLACE(A1,4,0,"20"),--A1)
Then format the cells:
mm/dddd

Excel date functions

I'm trying to get the current year/month/day military time in a cell. This is exactly what I need in the cell #Date:2017/AUG/14 14:55:08 I know this is super easy to do but I'm just not getting the result that I want. This is what I tried.
="#Date"=date(yyyy,MMM,D, hh:mm)
If you're after VBA:
="#Date:" & Format(now(),"yyyy/MMM/D hh:mm:ss")
If you're after a cell formula:
="#Date:" & TEXT(NOW(),"yyyy/MMM/D hh:mm:ss")
Note: Consider DD instead of D if you want day 1 to read 01 instead of 1
Just enter:
=NOW()
in a cell and custom format as "#Date:"yyyy/mmm/dd hh:mm

String that changes with cell value?

I have a cell into which I've typed the text "The year is 2014."
However, in my case the year might change - it might be 2015 or 2017, etc. I'd like the text within this cell to change with the value of a referenced year cell.
So, if cell A1=2015, then I want B1 to read "The year is 2015."
Any suggestions?
Using &:
="The year is "&A1&"."
Or using function:
=CONCATENATE("The year is ",A1,".")
Use following folrmula:
="The year is " & A1 & "."

Resources