How do I remove duplicate content within a sigle excel cell - excel

I have individual cells in excel with the following content in each of them
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg
This is one cell in a long row for a dump of data for products within an ecommerce site. A data migration has somehow added the same image more than once to the same product. Each separate image image is separated by the Pipe "|" symbol.
I want to search each cell in this column of the sheet and remove the duplicated image reference and the Pipe symbol.
So the examples above become
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
and
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg

The suggested answer of finding the pipe with SEARCH is a good general answer, however in this instance as the source string is always twice the length of the desired we can just chop it in half with the formula below and drag it down.
=LEFT(A1,(LEN(A1)-1)/2)

In addition to a formula, you can use Data>Text to Columns, which is a good thing to know about. Select the entire column and then you up the dialog. In step one choose "Delimited" and in step two choose the pipe symbol:
When you're finished, delete the first column.

I figured out that this works for some more complex scenarios. I think it should work for this one as well.
=IFERROR(LEFT(C2,(FIND(LEFT(C2,20),C2,2)-2)),C2)
I entered this into D2 and copied it all the way down the column. I then copied and pasted the values back into Column C.
The problem I had was that not all of the cells in my column had duplicate text. Of those that did, the duplications were not delineated by any unique character (There was a single space in front of each duplication.), and the duplicated text was often an incomplete duplication so the length was not consistently symmetrical.
The "20" is an arbitrary number of characters I picked for excel to use from the front of the text to identify where the text started to repeat. There are enough people here who know excel better than I who can explain what the rest of the formula does. I figured it out by poking around.

Related

How to clean string data rows that contain special characters such as "thereΓÇÖs not"

I'm cleaning a dataset for a project. There is a column that is called "Review Text," and I need to clean the data in rows that contain strange characters like "ΓÇÃ."
Using excel, I was able to use the "Substitute" function to create a formula to clean one row. However, I wanted to know how to create a nested "substitute" formula to clean all the rows in my dataset, if even possible. Please feel free to share any other possible solutions to my problem.
Excel Function
=SUBSTITUTE(J7,"IΓÇÖve","I've")
In this case, I wouldn't recommend a formulaic solution since it would involve you manually determining what type of replacement is needed for a given row. If there is a great number of types of errors, then you would need to create a unique formula for each unique type of error. In other words, you'd need to manually determine the type of error and the resulting SUBSTITUTE to fix the error.
So, it is much easier to simply Find and Replace each issue to avoid creating a complex formula that does the same task of cleaning. If you select your entire "Review Text" column, each error you fix will apply to the entire column automatically.
To see whether a cell has non-Alphanumeric characters in it, you can use the formula in this related StackOverflow post. You can apply this formula as a column next to the "Review Text" column. Then, you can continually sort for cells that have non-Alpha characters until you Find and Replace every type of error.
NOTE: If you wish to keep the old "Review Text" column, just copy this column into a separate column (e.g., "Review Text_old")

How to set a Child-Parent system?

I have an Excel file which includes lots of rows of information. I have actually a single problem which is I can't get the parent of each cells according to the information in the cell. It looks like this
In the image, you can see that A has no parent and its' children are A01 and AB and more and more like AC and AD. Is there any way for handling this issue with excel-formulas?
Assuming that your sample data is true to the format of all your data (there is either 2 numbers at the end of each parent or only an extra letter) then the following formula will work:
Given formula is set to look at data in cell A1, you will have to drag and auto fill the formula down for all rows.
=IF(OR(RIGHT(A1,1)="0",RIGHT(A1,1)="1",RIGHT(A1,1)="2",RIGHT(A1,1)="3",RIGHT(A1,1)="4",RIGHT(A1,1)="5",RIGHT(A1,1)="6",RIGHT(A1,1)="7",RIGHT(A1,1)="8",RIGHT(A1,1)="9")=TRUE,LEFT(A1,LEN(A1)-2),LEFT(A1,LEN(A1)-1))
It works by checking if the last character is a number (with this data excel treats it as text so we have to check for each number as if it is text), if it matches a number then show the parent minus the two right characters otherwise show the parent minus one character.
Okey I think I found the answer. Here is my formula
=IF(LEN(B2)=1;"NULL";IF(LEN(B2)=2;LEN(B2;0);IF(LEN(B2)=3;LEFT(B2;1);IF(LEN(B2)=4;LEFT(B2;3);IF(LEN(B2)=5;LEFT(B2;4);IF(LEN(B2)=7;IF(B2;5)))))))
With this formula, I check the length of the characters in cell and get the first part of that string instead of deleting the last indexes because of there are also some string values.
Because of there are some rules with my product codes, I figured out how they are changing and I got the part of the code by their sizes. Thanks for replies, they helped to find this solution.

Excel: Search rows for keywords and populate cells with those keywords

This question will be almost exactly like the question below, but I need a slight change to it for my application and I can't quite figure it out:
excel: how can I identify rows containing text keywords taken from a list of keywords
If a row of several text filled cells contains any keyword from a list of keywords, I would like to add that keyword to the end of the row. Each row will be the same number of cells, but some can be blank and they are not necessarily all the same data type, some could be numbers or dates etc. Even more, I would like to add every keyword that appears in the row of text to the end of the row in separate cells.
Relating to the example post that almost answers my question, I am using the more complicated formula for multiple matches, but in that example they only have one column of data they are looking for keywords in. I have several that would be formatted similar to their column A. I tried changing some of the ranges around with no luck specifically where the formula posted has: IF(COUNTIF($A1,"*"&$B$1:$B$10&"*") I changed $A1, to $A1:$D1 with no luck.
The problem showed up because I have several large spreadsheets of text based data about failure modes of different tools and I would like to categorize them in a little more of a controlled way than free form text in every cell and assigning controlled keywords that apply seems like a decent way to do this.
Example case
Expected result
The keyword list shown in Example Case is not shown in the Expected result. The range of keywords is K2:K6
Another feature that would be useful is if I could assign additional words that when found would trigger one of the key words. For example if the key word is "Gear wear" then "Gear wear" would trigger a hit but "stripped gears" would also trigger a hit. I would imagine the keyword list would be set up as a 2D Range with the first column being the actual key word and the cells to the right of each row would be additional words that trigger the key word. I suspect I am getting to the point where I would need to create a VBA macro to do this. If there is a way to accomplish this without writing code it would make it more repeatable on other user's computers.
Enter following formula in Cell F1 then drag/copy across and down as required.
=IFERROR(INDEX($K$2:$K$6,SMALL(IF(COUNTIF($A1:$D1,"*"&$K$2:$K$6&"*"),ROW($K$2:$K$6)-ROW($A$1)),COLUMNS($A1:A1))),"")
This is an array formula so commit it by pressing Ctrl+Shift+Enter
See the image for reference
This formula is derived from the link mentioned in your question.

Can Not Get My VLookUp In Excel To Return The Requested Data

Can Not Get My VLookUp In Excel To Return The Requested Data
I am trying to pull data from another sheet based on data selected from a dropdown on the main sheet.
All the formatting is "General"
=VLOOKUP(F15737,'Location Master'!$A:$J,2,FALSE)
It just keeps returning me #N/A
Try using the Index Match method. It's an alternative to Vlookup which doesn't require data to be sorted and can therefore be of more use.
The typical structure of this method is (the text inside the asterisk will give the ranges specific to your sheet:
=INDEX (**Column from which you want to return a value**, (MATCH(**Lookup Value**, **Column against which you want to lookup**,0))
In this case, if I've understood your workbook structure, the formula should look like this:
=INDEX('Location Master'!$B:$B,(MATCH(F15737,'Location Master'!$A:$A,0)))
This is a common problem with VLOOKUP(). Most likely you have some whitespace (A tab character or some spaces) after one of the values. Click on F15737 and see if there are any spaces at the end of it. Likewise, manually find the value in 'Location Master'!$A and check it for spaces or tabs after the value.
If the whitespace is found in F15737 then you can change your vlookup to be:
=VLOOKUP(TRIM(F15737),'Location Master'!$A:$J,2,FALSE)
If the whitespace is in the range to which you are looking up, then you'll need to trim all of those values, which you can do pretty quickly in a new column with the TRIM() formula.
If this doesn't solve the problem then you might have a number stored as text. Generally excel will tell you if this is the case within the cell with a little green corner indicator. To get Excel to automagically change a column from a "Number stored as Text" to a proper number you can:
Highlight the column
Go to Data>>Text To Columns
Click "Fixed Width"
Click "Finished"
Excel will then format everything automatically (dates to dates, numbers to numbers, text to text, time to time, etc.)

Storing numbers are text Excel 2007

When numbers are stored as text in Excel you see this little guy http://imgur.com/zXdwD
in the upper-left hand corner. when you click on it it gives you the option of converting the text representation of a number to a number upon which math can be done. also, when stored as text numbers appear on the left side of the cell opposed to the right one. I have an array of numbers which are stored as text, but they don't offer that little green thing to convert them to numbers. It may sound trivial but I'm using the Vlookup function to reference a large column of numbers to a code name, but it's not being recognized. And the only thing I can think of is that it's somehow being read differently (the codes are most defintely in the lookup table, and ctrl+f will find them). I want to know if anyone has an idea about what's happening.
Thanks.
The smart tag is a little finicky at times. There's a couple of things you can do.
If you're using code, you can multiply the cells in the range by 1, this will convert them to a number.
Alternatively you can convert the number you're matching to a string and then vlookup. Something similar to:
=VLOOKUP(TEXT(A1,"#"),B1:D10,2,false)
Note TEXT(A1,"#") would round to no decimal places, you may have to adjust the formatting.
The format of some of the cells in the lookup table maybe formatted as text. If there are a lot of them you can create a macro that corrects them. I had the same issue in this SO question although it was the opposite problem.
Another way to correct them would be to copy all the cells in the lookup table in that column and in an adjacent blank column edit>paste special>values>add which makes each of them numeric. Then copy them and paste those back over the originating cells.
A quick trick to convert all numbers formatted as text back to umber format is to copy the data into the "Notepad" application. Then select and copy the data from "Notepad back into your spread sheet and everything will be converted to number format.

Resources