Is there a way to replace cells of a particular value with multiple cells? - excel

Let's say I need to replace any cell that has a value of "outgoing" with multiple cells such as (0), (1), (0), (0), (2), in Excel. Is there a way to actually make this happen? I am doing this for a research project. Every item in my data needs to be coded on five different scales. There are 30-or-so items make up for almost half of the data. It would be enormously helpful to be able to simply replace the high frequency items with the five values at once.

I am not sure I completely understand the result you are looking for but here goes:
How about using the Find and Replace functionality to replace all instances of "outgoing" with "(0),(1),(0),(0),(2)" and then use the Text to Columns functionality to split the single column with "(0),(1),(0),(0),(2)" in to five separate columns, thus each value would be in its own cell.
You would need to split based on a delimiter (probably ",") and you should do all your replacing before you start splitting. Obviously you should test on some sample data first - Find and Replace is not your friend if you are not certain about your data set.

Related

identify when values in a column change in spotfire

I am trying to create a calculated column that flags/counts the changes in values across rows in another column, in Spotfire. Below is an example of the data types I'm looking at and the desired results.
My hope is that for each Location, and ordered along Time, I can identify when the values of "colors" changes and have running count so that each cluster of similar values between changes is given the same label (Cluster Desire 1) for each Location. It would be best if the running count of clusters can restart at each location but this is not crucial. Any help would be more than appreciated!
I thought of a way to do it, relying on one intermediate column (I used two just to make it a bit clearer).
First: the concatenation of values for each row within its Location: called [concatString]
Concatenate(Concatenate([Color]) over (Intersect([Location],AllPrevious([Time]))),', ')
Spotfire defaults to comma followed by space as a separator: I could not find a way of changing that in this kind of expression.
Then within each [concatString] I remove repeated values. The complication is that the last one did not have the comma+space, and I did not manage to make the regular expression I am using understand that. So my workaround was to add a final comma+space to [concatString]. Hence the extra Concatenate(..).
The formula for the column without repetitions, [consolidatString] is:
RXReplace([concatString],"(\\w+\,\\s)\\1+","$1","g")
Then what we have achieved is an individual value for each line we want to group. We can then simply rank [consolidatString] to achieve the desired column:
DenseRank([consolidatString],[Location])

finding time difference with 1 cell

I recently pulled a huge amount of data into a csv file, as a result a large amount of data is being formatted like this:
xx:xx-xx:xx - 'text'
The problem i'm having is this is all in one cell, I've tried looking online without much luck so basically wanted to know if it's even possible to find the time difference between xx:xx-xx:xx even if they're stored on the same cell? If not, is there a way to split these times into different cells en mass?
edit:
I've managed to remove the text from the cell, I now am left with 1 cell containing ranges similar to:
Please try, formatted as Time:
=MID(A1,7,5)-LEFT(A1,5)
If that does not work then check for leading spaces. Won't suit if times are late/early order, nor if spanning midnight.
Edited so there should be no need to strip out 'text'.

Is there a quick way for excel to identify and remove duplicate series from a cell such as this?

Is there a built in function, or a simple UDF that can identify the pattern in the information below and remove the duplicates?
Assume the following is all within a single excel cell:
80154, 80299, 80299, 82055, 82145, 82205, 82520, 82570, 83840, 83925,
83925, 83986, 83992, 84315, 80154, 80299, 80299, 82055, 82145, 82205,
82520, 82570, 83840, 83925, 83925, 83986, 83992, 84315
There are two sets of data (starts with 80154 ends with 84315). I want to end up with only one set, but I want to do it to 50,000 lines. The final output should be just the BOLD text. Also, sometimes the data repeats itself 3 times, again, I just want the unique set of data.
NOTE: I can't just remove duplicates, because sometimes there will be duplicates in the set that I need to capture in the final output. For example, (A,A,B,C,A,A,B,C) needs to be reduced to (A,A,B,C).
This finds where the first 20% is repeated and cuts the string at that point.
IF it does not find a duplicate it will return the whole string.
=IFERROR(LEFT(A1,FIND(LEFT(A1,LEN(A1)/5),A1,2)-3),A1)
Play with the 5 till you find the proper length of string that will get you the correct answer on all your strings. The higher the number the smaller the string it compares.
Also if it is cutting off too much or not enough, like leaving the , at the end adjust the -3 up and down.

excel vba Delete entire row if cell contains the GREP search

I have a single column of text in Excel that is to be used for translating into foreign languages. The text is automatically generated from an InDesign File. I would like to clean it up for the translator by removing rows that simply contain a number ("20", 34.5" etc), or if they contain a measurement "5mm", "3.5 µm", etc. I've found many posts (see link below) on how to remove a row with specific string, but none that use search strings, such as those I typically use with GREP searches: "\d+" and "\d.\d µm"
How would I do this? I am on Mac iOS if that helps.
Note that I would need to delete the row if the cell only contains a number or a measurement, not if the number is contained within a phrase, sentence, or paragraph, etc.
https://stackoverflow.com/a/30569969
It may not be what you are looking for, but how about just sorting the column and remove the rows starting with numbers? It is a manual approach but from what I understand this translation process only happens from time to time. Am I right?
I see two possible issues in your question:
How to work with regular expressions in Excel?
How to delete rows in a loop?
Let me start with the second question: when you want to create a for-loop in order to remove items from a list, you MUST start at the end and go back to the beginning (it's a beginner's trick, but a lot of people trip over it.
About the first question: this is a very useful post about this subject, it's too large to even give a summary here.

How can I replace specific text inside an excel cell with text from a different column

I have a very large spreadsheet where I need to replace a word in one column with text from another on a large scale.
I need to replace one word (in this case it is [Rate]) with information from a different column.
ex: Fixed rate of [Rate] per kilowatt hour.
finished product: Fixed rate of 0.0652 (number found in different column) per kilowatt hour.
Is this possible on a large scale? There is 800 something of these that I need to update but my work application is rather slow and if I can streamline this it will save me hours of time.
Use the substitute function:
The information page is found at:
Syntax
SUBSTITUTE(text,old_text_or_reference,new_text_or_reference,inst)
Text:the text (as string) or reference in which you want to replace
Old_text:Text to be replaced in the string
New_text:Is the text or reference you want to replace old_text with.
inst: Not a compulsory variable. Is which consecutive number of the occurrence of the old_text that you want to replace.
http://office.microsoft.com/en-nz/excel-help/substitute-function-HP010062578.aspx

Resources