Replace blank space by "-" inside excel field - excel

I have value as below into columnA:
00259695 YYYYMMDD.CSV
004001 YYYYMMDD.CSV
004002 YYYYMMDD.CSV
0051TZTT YYYYMMDD.CSV
04002B YYYYMMDD.CSV
How to simply add "-" instaed of blank space between name and YYYYMMDD.csv?
To get like this:
00259695-YYYYMMDD.CSV
004001-YYYYMMDD.CSV
004002-YYYYMMDD.CSV
0051TZTT-YYYYMMDD.CSV
04002B-YYYYMMDD.CSV

With data in column A, in B1 enter:
=SUBSTITUTE(A1," ","-")
and copy downwards:

Select the column where there's your date format
CTRL+H
Find : add the blank space
Replace with : just the '-'
And then replace all
You could easily find it with Google

Use excels find and replace,
Copy the white space only,
Select only the range you wish to do this to.
CTRL+h
Expand on the options and un-tick match all cell
Enter in the replace section "-"
Done
Did you want a macro?

Related

Extract value within only first set of parenthesis | Excel

Essentially:
I have a cell value that looks like this:
Hello - (Whats Up (HowAreYou))
I need to extract the value of what is inside the outside parenthesis:
Whats Up (HowAreYou)
How can this formula be modified to accommodate this requirement:
=MID(C11,SEARCH("(",C11)+1,SEARCH(")",C11)-SEARCH("(",C11)-1)
use FILTERXML:
=FILTERXML("<a>"&SUBSTITUTE(SUBSTITUTE(A1,"(","<b>",1),")","</b>",LEN(A1)-LEN(SUBSTITUTE(A1,")","")))&"</a>","//b")
Or:
=MID(REPLACE(A1,FIND("#",SUBSTITUTE(A1,")","#",LEN(A1)-LEN(SUBSTITUTE(A1,")","")))),999,""),FIND("(",A1)+1,999)
Try:
=MID(A1,SEARCH("(",A1)+1,SEARCH("#",SUBSTITUTE(A1,")","#",LEN(A1)-LEN(SUBSTITUTE(A1,")",""))))-SEARCH("(",A1)-1)
Amongst the other good answers, you could alternatively try:
=REPLACE(LEFT(A1,MATCH(2,1/(MID(A1,SEQUENCE(LEN(A1)),1)=")"))-1),1,FIND("(",A1),)
Or, without Excel 365:
=REPLACE(LEFT(A1,MATCH(2,1/(MID(A1,ROW(A$1:INDEX(A:A,LEN(A1))),1)=")"))-1),1,FIND("(",A1),)
Note: This last formula requires you to enter as array formula through Ctrl+Shift+Enter
You can also use "Text To Column" function. You can find it in data tab in data tools group.
Select the cell or column that contains the text you want to split.
Select Data > Text to Columns.
In the Convert Text to Columns Wizard, select Delimited > Next.
Select the Delimiters "space" and "other" << put "-" in the text box next to "other" > Next.
Slect the location where you want that data and click finish.
Note: by this way you will end up with double bracket at the end that you can fix with replace function. Selecd your data and click find and replace. Put )) in find box and ) in replace window, click replace all.
Formula:
Assuming your data is in cell A1
Hello - (Whats Up (HowAreYou))
= RIGHT(SUBSTITUTE(A1, "))", ")", 1), LEN(SUBSTITUTE(A1, "))", ")", 1)) - SEARCH(" - ", SUBSTITUTE(A1, "))", ")", 1))

how to append a multi-line text after a formula in Microsoft Excel?

I can make an automatically calcuated value appear a cell using '=' operator. For example, when cell F20 is 200, I can enter in cell G20
=F20/10
Then, I see 20 in cell G20.
Now I want to add a note in cell G20 so that it appears
20
note 4)
I know I can do
=concatenate(F20/10," note 4)")
but this obviously shows
20 note4)
which is not what I want.
How can I put enter(new line) in the appended text in this case?
You can use CHAR(10) which is newline:
=concatenate(F20/10,CHAR(10),"(note 4)")
Make sure you have 'Wrap Text' turned on for it to work.

How to subset text from an Excel cell

I have an Excel document with a column full of things that look like this:
Hume F;Wilhelm K;
I want to copy this into a blank cell to the right of it, but only what's before the first semicolon. So it would end up looking like this:
Hume F
Option 1
Copy the column, on the copy Text To Columns with ; as the delimiter and delete the surplus
Option 2
Copy and Paste the entire column then select it Find & Replace, Find what: ;*, Replace All
Option 3
=LEFT(A1,FIND(";",A1)-1)
for example
=LEFT(A1;SEARCH(";";A1)-1)

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.

Add common prefix to all cells in Excel

I have a column with some text in each cell.
I want to add some text, for example "X", at the start of all cells. For example:
A B
----- >>>> ----
1 X1
2 X2
3 X3
What is the easiest way to do this?
Type this in cell B1, and copy down...
="X"&A1
This would also work:
=CONCATENATE("X",A1)
And here's one of many ways to do this in VBA (Disclaimer: I don't code in VBA very often!):
Sub AddX()
Dim i As Long
With ActiveSheet
For i = 1 To .Range("A65536").End(xlUp).Row Step 1
.Cells(i, 2).Value = "X" & Trim(Str(.Cells(i, 1).Value))
Next i
End With
End Sub
Select the cell you want to be like this,
Go To Cell Properties (or CTRL 1)
under Number tab
in custom
enter
"X"#
Select the cell you want to be like this, go to cell properties (or CTRL 1) under Number tab in custom enter "X"#
Put a space between " and # if needed
Select the cell you want,
Go To Format Cells (or CTRL+1),
Select the "custom" Tab, enter your required format like : "X"#
use a space if needed.
for example, I needed to insert the word "Hours" beside my numbers and used this format : # "hours"
Enter the function of = CONCATENATE("X",A1) in one cell other than A say D
Click the Cell D1, and drag the fill handle across the range that you want to fill.All the cells should have been added the specific prefix text.
You can see the changes made to the repective cells.
Option 1:
select the cell(s), under formatting/number/custom formatting, type in
"BOB" General
now you have a prefix "BOB" next to numbers, dates, booleans, but not next to TEXTs
Option2:
As before, but use the following format
_ "BOB" #_
now you have a prefix BOB, this works even if the cell contained text
Cheers, Sudhi
Michael.. if its just for formatting then you can format the cell to append any value.
Just right click and select Format Cell on the context menu, select custom and then specify type as you wish... for above example it would be X0. Here 'X' is the prefix and 0 is the numeric after.
Hope this helps..
Cheers...
Go to Format Cells - Custom. Type the required format into the list first. To prefix "0" before the text characters in an Excel column, use the Format 0####. Remember, use the character "#" equal to the maximum number of digits in a cell of that column. For e.g., if there are 4 cells in a column with the entries - 123, 333, 5665, 7 - use the formula 0####. Reason - A single # refers to reference of just one digit.
Another way to do this:
Put your prefix in one column say column A in excel
Put the values to which you want to add prefix in another column say column B in excel
In Column C, use this formula;
"C1=A1&B1"
Copy all the values in column C and paste it again in the same selection but as values only.
Type a value in one cell (EX:B4 CELL). For temporary use this formula in other cell (once done delete it). =CONCAT(XY,B4) . click and drag till the value you need. Copy the whole column and right click paste only values (second option).
I tried and it's working as expected.

Resources