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 & "."
Related
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)
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")
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
How would you change this date type Monday, 31, August2015 at 6:08 AM to short date in Excel 31/08/2015 ?
Currently I use Text to Columns on the top date, find and replace to remove the comma on 31,. Then use a combination of =text(1,"00") and =month(A1&1 to format the numbers correctly and finally =concatenation() to join them all together.
This is time consuming and concatenated dates are in a different format to short date formats. When uploading data the software will see them as such.
I'm hoping there is a really easy way of doing this to save time.
It's a long formula, but it works. Before using it make sure you set the Number Formatting for the formula cell to the short date that you want.
Assuming that your awkward date is in cell A1, enter this formula in another cell:
=DATEVALUE(VALUE(SUBSTITUTE(MID(MID(A1,FIND(" ",A1)+1,99),1,2),",","")) & " " & MID(A1,FIND("|",SUBSTITUTE(A1," ","|",2))+1,3) & " " & MID(A1,FIND("|",SUBSTITUTE(A1," ","|",3))-4,4))
I have two cells in Excel. one has a string and the other one has a date. in the third cell I want to put the date and the string together. For example:
A1 = "This "
A2 = "03/03/1982"
I want A3 to be:
This 03/03/1982
when I try to put this in the A3 formula: = A1 & A2 it returns some funny numerical value for the date and does not give me the literal date.
Don't know if it's the best way but I'd do this:
=A1 & TEXT(A2,"mm/dd/yyyy")
That should format your date into your desired string.
Edit: That funny number you saw is the number of days between December 31st 1899 and your date. That's how Excel stores dates.
This is the numerical representation of the date. The thing you get when referring to dates from formulas like that.
You'll have to do:
= A1 & TEXT(A2, "mm/dd/yyyy")
The biggest problem here is that the format specifier is locale-dependent. It will not work/produce not what expected if the file is opened with a differently localized Excel.
Now, you could have a user-defined function:
public function AsDisplayed(byval c as range) as string
AsDisplayed = c.Text
end function
and then
= A1 & AsDisplayed(A2)
But then there's a bug (feature?) in Excel because of which the .Text property is suddenly not available during certain stages of the computation cycle, and your formulas display #VALUE instead of what they should.
That is, it's bad either way.
Another approach
=CONCATENATE("Age as of ", TEXT(TODAY(),"dd-mmm-yyyy"))
This will return
Age as of 06-Aug-2013
Thanks for the solution !
It works, but in a french Excel environment, you should apply something like
TEXTE(F2;"jj/mm/aaaa")
to get the date preserved as it is displayed in F2 cell, after concatenation.
Best Regards
You can do it this simple way :
A1 = Mahi
A2 = NULL(blank)
Select A2 Right click on cell --> Format cells --> change to TEXT
Then put the date in A2 (A2 =31/07/1990)
Then concatenate it will work. No need of any formulae.
=CONCATENATE(A1,A2)
mahi31/07/1990
(This works on the empty cells ie.,Before entering the DATE value to cell you need to make it as TEXT).
I found that for this situation, the simplest solution is to define a Custom number format for the cell containing the date. The format in this case should be:
"This:" mm/dd/yyyy
To set this format:
Right click on the cell
Select Format Cell
Select Number tab (should be displayed by default)
Pick Custom from the Category list
Specify the format in the "Type" field
Press OK
Note: If you really want the preceding text to be picked from a cell, this solution will not work as described.