Remove parentheses with text in Excel - excel

I have a list of employee names. Some names are in the format as
John Smith
Some names on the same list are listed as
Jane Smith (Terminated)
For the terminated names I need to remove the (Terminated) in excel.
How do I do this?

A simple solution is to use the replace function:
=SUBSTITUTE(C3,"(Terminated)","")
Where C3 is the cell that contains the text you want to modify.

Since you do not have Formula or VBA tags on your question, another way to do this is to use the Find and Replace functionality of Excel.
1
On the sheet where you wish to remove the parentheses with text, press Control-F on the keyboard.
2
When the dialog opens, click the Replace tab.
3
Type the following WITHOUT the quotation marks:
" (Terminated)"
Notice that there is a space character just before the first paren. Again, don't type the quotation marks.
4
Leave the Replace with field blank.
5
Click the Replace All button.

Related

Extract Text from Before or After multiple symbols

Currently I have a log file from restaurant which contains the product name and all.
I have to extract only Product name but not its price which is on same cell.
Report Format
Product Code | Product Name
00041 Beef Salted Tongue,1000 Yen (excl.tax)
00042 Pork Loin, 980 Yen (excl.tax)
Not that Every product name ends with " , [price][excl.tax]
So is there anyway to remove it from whole column?
I have used =LEFT(A1,(FIND(",",A1,1)-1))
It does help but some of the product contains multiple "," .
For Example : Eggs,Pickles,Sauce, Pepper .
So If I use the above formula, It only gives me Eggs.
Posting answer as per discussion over the comments:
Use the below link to find the location of last comma in your cell contents.
Excel: last character/string match in a string
To solve the second issue you encountered (pasting the value across filtered rows), refer to the below solution (courtesy TurgutKapisiz)
This does exist in Excel (despite being hidden or not immediately
intuitive).
After you have selected the data you need to copy into the
non-contiguous cells that have been filtered:
In Excel 2007 and earlier: Edit-> Go To -> Special -> Visible Cells
Only will select the data, then you do a Paste Special Values In Excel
2010 and above: in the Home tab Find and Select -> Go to Special ->
Visible Cells only will select the data, then you do a Paste Special
Values
Enter the following Formula in cell B3
=IF(ISERROR(FIND(" Yen ",B2,1)),B2,LEFT(B2,FIND("#",SUBSTITUTE(B2,",","#",LEN(B2)-LEN(SUBSTITUTE(B2,",",""))),1)-1))
Part 1 of the Formula checks the presence of Yen.
If there is a possibility that there can be a product with the text Yen the you may replace this part with If(Right(B2,1)=")") or any other unique text that exists only when price of the item is present.
Part 2 of the formula, substitutes comma and compares the length of the text before and after the comma is replaced. It replaces the comma with Has (#), and returns the text to the left of the Hash.
Do let me know if this is what you wanted to do or if require any changes.
Regards,
Vijaykumar Shetye,
Panaji, Goa,
India
The required formula is shown in the attached image for your calculation of extraction of required text (click on the Image for clarity).
=LEFT(B2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B2&"0123456789"))-1)
//For the data or info # B2 cell in excel
Output

Removing of hypen in excel

In excel, i have a column having data's like C-45RE. In another column of the same spreadsheet, I need to display C45RE. In excel how is it possible?
=LEFT(A1,FIND("-",A1)-1)&MID(A1,FIND("-",A1)+1,99)
In English: Take the left part of my text in A1. Stop 1 character before the -. Then add the middle part of my text in A1. Start 1 character after the -. Get up to 99 characters.
Use the SUBSTITUTE function:
=SUBSTITUTE(A1,"-","",1)

Having an issue with excel "text to columns" feature - need to remove space

I have 100's of rows of data, each row containing a list of multiple items separated by comma. for example:
a fox, a frog, a dog, candy,
tyler, daren, hogge, laura,
cat in the hat, remembering your favorite day, having a fun time
etc
as you can see, its not a simple "lastname, firstname" separation.
the issue im having is when i use text to columns, i can easily separate by comma, but im then left with a space before every second item in the list. I need to remove the space after each comma (but not EVERY space after each word!)
I cant just select "comma" and "space" in the delimiters option, because then it removes EVERY space between words (eg 'havingafuntime') when i only want to remove THE ONE space after the comma.
I know i can use "trim" - but im wondering if theres a way to remove the space WHILE SEPARATING THE TEXT TO COLUMNS, all in one swoop.
When working "normal" with excel you can simply left out any formulas for this case.
Instead of the =SUBSTITUTE(A1,", ",",") you can simply select the range you want to be corrected (like the whole A:A column) and press Ctrl+H (replace). Set "Find What" to ", " and "replace with" to "," (without the "). Hit replace all the to do it for the whole selection (non selected cells won't be replaced).
The build-in "Text to columns" can not be manipulated in a way to do it in one step.
EDIT:
Doing it as a one-click-macro just this 4 lines should do what you desire:
Sub text2cols()
Selection.Replace ", ", ","
Selection.TextToColumns Selection.Resize(1, 1), 1, , , , , True
End Sub
Just select the range you want to seperate and run the macro ;)
in the cell adjacent to the start of the column you are going to convert using text to columns, enter the following formula and copy down.
=substitute(A1,", ",",")
This will remove the space after every ,
Then copy and paste as value the resulting column.
Then perform your Text to Columns operation using , as you delimiter.
Another option would be to use Power Query.
Depending on your version of excel you should be able to download an install Power Query by googling "Download Power query for Excel 20X"
click in your data set
On Power query tab you will see "From Table" (in excel 2016 its already in data tab, you do not have to download it)
choose if your data has header or not
Go to Transform
Under Split column choose by delimiter
Choose comma
Under Format you will see Trim
Go to Home tab choose close and load
and you're done
I know this is an old post, but I found this doing a google search because I had the same problem as the OP. However, upon reading some of the suggestions it came to me that I can use the Find & Replace feature. I selected the column in question and did the following:
Find what: ", " (without quotes - used to show space)
Replace with: , (no space)
Essentially this made the list go from: a fox, a frog, a dog, candy, tyler, daren, hogge, laura, cat in the hat, remembering your favorite day, having a fun time
And changed it into this: a fox,a frog,a dog,candy,tyler,daren,hogge,laura,cat in the hat,remembering your favorite day,having a fun time
Then I just used the Text To Column function delimited by comma and it worked beautifully.
I hope this helps someone else out.

Excel - Multiple Line cells

Excel Multiple Lines
In excel i have cells with multiple lines in them - like this
25 Eagle Street
Boondall
What i am trying to do is make them back into one line again as follows -
25 Eagle Street Boondall
Is there some sort of way i can do this in excel? I have over 40000 cells to sort that are multiple lines. I am using a c# i created to separate the suburbs from the addresses, but i cannot do this with these multiple lines because i will get incorrect results. Help would be greatly appreciated.
If these are line breaks entered by pressing Alt+Enter, you can replace them all with Excel's find/replace command. Select "Edit > Replace..." form the main menu or press the shortcut Ctrl+H and in the "Find what:" box you can enter the line-break code, which is character 10. To do this, press and hold the Alt key, and then enter the numbers 010 from the numeric keypad. You'll probably want to replace them with a space to maintain formatting.

Remove leading or trailing spaces in an entire column of data

How do I remove leading or trailing spaces of all cells in an entire column?
The worksheet's conventional Find and Replace (aka Ctrl+H) dialog is not solving the problem.
Quite often the issue is a non-breaking space - CHAR(160) - especially from Web text sources -that CLEAN can't remove, so I would go a step further than this and try a formula like this which replaces any non-breaking spaces with a standard one
=TRIM(CLEAN(SUBSTITUTE(A1,CHAR(160)," ")))
Ron de Bruin has an excellent post on tips for cleaning data here
You can also remove the CHAR(160) directly without a workaround formula by
Edit .... Replace your selected data,
in Find What hold ALT and type 0160 using the numeric keypad
Leave Replace With as blank and select Replace All
If you would like to use a formula, the TRIM function will do exactly what you're looking for:
+----+------------+---------------------+
| | A | B |
+----+------------+---------------------+
| 1 | =TRIM(B1) | value to trim here |
+----+------------+---------------------+
So to do the whole column...
1) Insert a column
2) Insert TRIM function pointed at cell you are trying to correct.
3) Copy formula down the page
4) Copy inserted column
5) Paste as "Values"
Should be good to go from there...
Without using a formula you can do this with 'Text to columns'.
Select the column that has the trailing spaces in the cells.
Click 'Text to columns' from the 'Data' tab, then choose option 'Fixed width'.
Set a break line so the longest text will fit. If your largest cell
has 100 characters you can set the breakline on 200 or whatever you
want.
Finish the operation.
You can now delete the new column Excel has created.
The 'side-effect' is that Excel has removed all trailing spaces in the original column.
If it's the same number of characters at the beginning of the cell each time, you can use the text to columns command and select the fixed width option to chop the cell data into two columns. Then just delete the unwanted stuff in the first column.
I've found that the best (and easiest) way to delete leading, trailing (and excessive) spaces in Excel is to use a third-party plugin. I've been using ASAP Utilities for Excel and it accomplishes the task as well as adds many other much-needed features. This approach doesn't require writing formulas and can remove spaces on any selection spanning multiple columns and/or rows. I also use this to sanitize and remove the uninvited non-breaking space that often finds its way into Excel data when copying-and-pasting from other Microsoft products.
More information regarding ASAP Utilities and trimming can be found here:
http://www.asap-utilities.com/asap-utilities-excel-tools-tip.php?tip=87
I was able to use Find & Replace with the "Find what:" input field set to:
" * "
(space asterisk space with no double-quotes)
and "Replace with:" set to:
""
(nothing)

Resources