Replacing colon with comma - excel

I have time entries of the form:
12:45:55:346 (hh:mm:ss:mss)
And I want to convert it to the form:
12:45:55,346 (hh:mm:ss,mss)
How shall I proceed, please?

You can use the SUBSTITUTE function and specify the 4th parameter:
With input in A1:
=SUBSTITUTE(A1,":",",",3)

With data in A1, in B1 enter:
=LEFT(A1,LEN(A1)-4) & "," & RIGHT(A1,3)

This formula will do the trick:
=REPLACE(A1, 9, 1, ",")
Although this is not something I'd exactly recommend and is likely to
mess up your formatting.
If you truly insist on using this formatting, then keep the original data in a hidden column and do all the calculations with it. The data in this format should just be used to display the current / final result(s).

Related

Excel formula concat text in excel without zero values

I am new to excel formulas.
How to skip the zeros and the show result in image format with the yellow colour columns in the excel formula?
If the results are not always in ascending order (if they are #Solar Mike has already solved it for you with MAX) then perhaps:
=A2&" "&LOOKUP(2,1/(B2:D2<>0),B2:D2)
As per your sample data it seems simple below formula should work.
=A2&" "&MAX(B2:D2)
Or can try-
=A2 & " " & XLOOKUP(1000,B2:D2,B2:D2,,-1,-1)
and if you want actually non zero right cell data (including text data) then use FILTERXML() like-
=A2& " " & FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,FILTER(B2:D2,B2:D2>0))&"</s></t>","//s[last()]")
Looking at your results however, then this:
Something like:
=if(A2>0,A2&" ","")&if(B2>0,B2&" ","")&if(C2>0,C2&" ","")&if(D2>0,D2&" ","")
will work.
Probably could be made shorter... And should work with all versions of Excel.
Ba

Change "XX:XX:00" to "00:XX:XX"

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")))

How to extract middle characters from a cell in Excel

I need a excel function code that would enable to me extract certain characters in the middle of a cell.
So in cell A74 is:
1625362674848-cdpresent-auths_ol_mart-auths1837372
So I Need to extract "auths_ol_mart" into a separate column
I have tried this:
=MID(A2, SEARCH("-",A2) + 1, SEARCH("-",A2,SEARCH("-",A2)+1) - SEARCH("-",A2) - 1)
Now the problem is this only gets "cdpresent". I am not quite sure how this is done.
more examples include:
3837463747-cdpresent-avaya_op_history-clm1827489
I want "avaya_op_history"
3734279458-cdpresent-uk_score_app-clm9377233
I want "uk_score_app"
Thank you all
You can use this worksheet formula:
=LEFT(MID(A1,FIND("-",A1,FIND("-",A1)+1)+1,99),FIND("-",MID(A1,FIND("-",A1,FIND("-",A1)+1)+1,99))-1)
If you use the Formula Evaluation tool, you will be able to see how this works.
If you prefer a UDF, you can use:
Function betweenDashes(S As String) As String
betweenDashes = Split(S, "-")(2)
End Function
Edit (20MAR2020)
Another formula to return the third item in the string, if you have Excel 2013+ and the FILTERXML function:
=FILTERXML("<t><s>" & SUBSTITUTE(A1,"-","</s><s>")& "</s></t>","//s[3]")
or, if you prefer, the next to last item:
=FILTERXML("<t><s>" & SUBSTITUTE(A1,"-","</s><s>")& "</s></t>","//s[last()-1]")
An alternative way to formula is Text to Columns with hyphen (-) as a delimiter. You get what you are looking for in the 3rd column:

Excel and cell formatting to text

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

Excel formula to remove space between words in a cell

I've a huge data in excel file.
For eg: say i've a word like paul son,i've to make it as paulson.
input:paul son
output:paulson.
In some cells ,i've data like mic-li,when this type of words come,it should not replace any thing,it should only remove spaces in between words.
Suppose the data is in the B column, write in the C column the formula:
=SUBSTITUTE(B1," ","")
Copy&Paste the formula in the whole C column.
edit: using commas or semicolons as parameters separator depends on your regional settings (I have to use the semicolons). This is weird I think. Thanks to #tocallaghan and #pablete for pointing this out.
It is SUBSTITUTE(B1," ",""), not REPLACE(xx;xx;xx).
Steps (1) Just Select your range, rows or column or array ,
(2) Press ctrl+H , (3 a) then in the find type a space
(3 b) in the replace do not enter anything,
(4)then just click on replace all.....
you are done.
Just wanted to add on to vulkanino's answer... now 10 years later ha. This is what I was looking for maybe someone else is too. You can also build on multiple =SUBSTITUTE() functions.
Here is what I used to format a list of names for Active Directory accounts. B2 is where the name would go. I wanted to change the space between the First name and last to a period and omit any hyphens from names.
=SUBSTITUTE(SUBSTITUTE(B2, " ", "."), "-", "")
For example the line above would look like this:
First Last-Name => First.LastName
, "-", "")
This part removes the hyphen.
(B2, " ", ".")
This part selects the cell to modify and changes empty space to a period.
=SUBSTITUTE(SUBSTITUTE(...)...)
I used two substitute functions one inside the other.

Resources