So I have this data directly copy/paste from iTunes :
Excel have "XX:XX:00" format which is "hh:mm:ss" but as you can imagine, it is more like "mm:ss:00". Musics are not hours long !
As it's not a direct cell format problem, I couldn't find easily the answer on internet. I need sometihng to put the 2 "00" at the start (in order to have "00:mm:ss")
EDIT : It was a cell format comprehension problem.
You can just divide the cell value to 60 like so
and then choose custom format for that cell like this
Format the cell with the time (C1) as "General". If it retains its value, like 11:42, then convert it with =TimeValue(C1) and format the cell as Custom mm:ss
If it changes to something like 0.4875 then convert it with =C1/60 and format the result as Custom mm:ss
This formula should work:
="00:" & MID(TEXT(A1,"h:mm:ss"),SEARCH(":",TEXT(A1,"h:mm:ss"))+1,3) & RIGHT(TEXT(A1,"h:mm:ss"),2)
The important element is to convert the time into a text string.
Change A1 to the first cell of Duration (Duree) & copy the formula downward
Then, you can copy the result and paste it as values
Edit: you can also use just the right function:
="00:"&RIGHT(TEXT(A1,"h:mm:ss"),LEN(TEXT(A1,"h:mm:ss"))-SEARCH(":",TEXT(A1,"h:mm:ss")))
Related
Within an Excel cell, I want to have the current (dynamic) date time printed.
I tried with following format:
TEXT(TODAY(); "ddmm");TEXT(TIME(HOUR(NOW());MINUTE(NOW());SECOND(NOW()));"mmss")
The format cell is not formatted as text. However, when I select the cell I have exactly that what is typed iso 07111533
I tried already with TEXT(TODAY(); "ddmm") and then my cell is filled with 0711, which is ok.
Expected result should be something like 07113815
Actual result:
TEXT(TODAY(); "ddmm");TEXT(TIME(HOUR(NOW());MINUTE(NOW());SECOND(NOW()));"mmss")
You're over-complicating:
=TEXT(NOW(),"ddmm") & TEXT(NOW(),"mmss")
I have cells containing a simple concatenation function with D24 as the previous year (e.g. 15) and a custom format (MMM JJ)
CONCATENATE("Apr ",$D$24)
When I am copying and pasting these cells with a VBA then "Apr 15" becomes "15.04.16" and because of the formatting "Apr 16"
Selection.Value = Selection.Value
Was is the reason behind this? Is there another solution than just changing the format to text?
Excel will generally try to convert anything that looks like a date into a real date (serial number where 1 = 1 Jan 1900). One way to avoid that, and remove the formula as you are doing above, would be to pre-format as text. So:
With Selection
.NumberFormat = "#"
.Value = .Text
End With
might do what you want.
There are other ways, but if you don't change the cell format to text, or prefix the entry with a single quote ', any subsequent editing of that cell, even inadvertent selection, raises the risk of converting it to the real date.
That depends on what you want in your cell. Dou you want a string or a date?
If you want a string:
either format as text or
add a ': CONCATENATE("'Apr ",$D$24)
if you want a date:
use the following formula instead of concatenate: =DATE($D$24,4,1)
If you simply Copy Paste it, only the Value is pasted not the formatting (if I remember right)
Try to avoid using Selection instead use Range.
And use Range.Copy and Range.PasteSpecial Paste:=xlPasteFormats so your formatting is pasted with the values.
I would like to get the following string as a date formatted:
="Status: "& TODAY()
However, I get:
Status: 42418
I would like to get:
Status: 18.02.2016
I already tried to change the format to Date or use the Datevalue function.
Any suggestions, how to get the current date correctly formatted?
You can format the date manualy with DAY(),MONTH() and YEAR() function.
="Status: "& DAY(TODAY())&"."& MONTH(TODAY())&"."&YEAR(TODAY())
Or you can use the TEXT() function to do the formatting.
="Status: " & TEXT(TODAY();"DD.MM.YYYY")
A better way to do this is just change the number format.
Change your cell formula back to =today()
Select the Format menu, then Number, More Formats, and finallay More date and time formats
Then set the custom format as followed:
The benefit of this is that the value of your cell is still a date, not string
EDIT
This answer primarily illustrate separation of presentation and data.
Think of currency. 2 is data, and US$ 2.00 is presentation of the data. When you compute the value, you just want to put the number 2 instead of a formula like = "US$" & data & ".00"
This makes the spreadsheet more robust to any future change where you want to reference your computed values in other cells.
Another example would be win-loss computation. It's better to output the value TRUE/FALSE or 1,0,-1 and then have a custom format to convert the value to text. (In this case, the format rule is "WIN";"LOSS";"DRAW")
I have a cell with the contents of 41316. I have it formatted as 20130211.
I need another cell to reference that value, but in the cell have it showing as 20130211 not 41316 formatted.
This maybe an easy one, but for some reason it has me running in circles.
Thanks in advance for all responses.
Excel by default copies the format from a cell formatted as a date to a cell which references it. It sounds in your case that Excel hasn't done that for you, so you just need to format the new cell with your special format : paintbrush tool or Edit..Copy, Edit..Past Special..Formats or Format..Number..Custom and select your format, which will be at the bottom of a long list.
If a string is ok instead of a number, you can decompose that date in parts and concatenate:
Being A1 the cell containing the value:
= Year(A1) & "/" & Month(A1) & "/" & Day(A1)
The "&" symbol concatenates text. The slashes are optional if you want them separated by slashes.
if your cell referencing 20130211 is 'A1' put =TEXT(A1,"####") in your calculation cell. If you do it this way then it will still read as a number and not a string
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.