Is there a way to concatenate based on a specific character? I've used concatenate in the past based on x number of characters from the left, for example, but I need to concatenate based on a slash.
For example,
In column a I have part numbers such as 09-K1450V/XXL, 09-K1450V/XXXL, 16-150V/L
16-150V/M, 16-150V/S. What I'm building is a description field that should first contain the size information. So I'd like to pull all information after the slash in column a.
The formula you want is:
=MID(A1,FIND("/",A1)+1,LEN(A1))
Related
I need to update hundreds of cells, and that would be trivial automating, but I am not being able to make it work.
I have a list like the following:
And, in a different tab, a list I have to populate with values above (in B) based on the appearance of the twitter handle in other column.
The names are within a long text string (all of them begin with #), and it is not possible to re-order the list based on those names. Also, there are more names than values, so some cells will remain blank.
Is there a way I can write a formula that writes the values of the first list into the second one if the name in column A in that row is contained within the adjacent string?
Thanks!
You can refer to this sample formula (Same sheet was used):
=arrayformula(if(C2:C<>"",iferror(vlookup(REGEXEXTRACT(C2:C,"\B\#\w+"),A2:B,2,false),""),""))
What it does?
Use array formula to loop column C values
Extract the twitter name (string that starts with #) using Regexextract()
Use the extracted #twittername as search key to get the connections value using vlookup()
Output:
Since we don't have access to the spreadsheet, I can't know for sure what the line-break character is within the Col-A cells of your second sheet. And using this line-break character is important, since Twitter handles may use some non-alphanumeric characters such as the underscore and others which are not included in such REGEX notation as \w. I'm assuming here that the line-break character is CHAR(10) from the ASCII chart.
I also don't know the name of your first sheet; so here, I've just written it as Sheet1. You'll need to replace that with your actual sheet name, remembering to place it in single quotes if it contains anything but alphanumeric characters (e.g., 'Data Sheet').
That said, delete everything from Col-B in your second sheet (including the header "Connections") and place the following formula in cell B1 of that second sheet):
=ArrayFormula({"Connections"; IF(A2:A="",, IFERROR(VLOOKUP(REGEXEXTRACT(SUBSTITUTE(A2:A,CHAR(10),"~"),"#[^~]+"),Sheet1!A:B,2,FALSE)))})
I have a document in google sheets and the column consists of the name and version, like NLog.Config.4.3.0, NLog.Config.4.4.9 and so on.
See the image below for other examples.
I need to divide this into two columns - name and version, but I'm not familiar with regular expressions so close that I can get this info.
I can use excel and then import it to the Google doc, it doesn't matter for me how to do that.
enter image description here
You can try something like this:
Suppose you have your string in A1, then in B1 you can enter this:
=LEFT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")))
and in C1 this:
=RIGHT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))+1)
you may need to do some adjustments if there are cases without numbers as it will produce an error, for example you can round it with an Iferror like this:
=IFERROR(LEFT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))),A1)
Note: A1&"0123456789" is a 'trick' to avoid the search to return error, as the search is looking for all the numbers in the array; we just need the position of the first one, thus the MIN().
Supposing that your raw data were in A2:A, place this in B2:
=ArrayFormula(IFERROR(REGEXEXTRACT(A2:A,"(\D+)\.(.+)"),A2:A))
The regular expression reads "Extract any number of non-digits up to but not including a period as group one, and everything remaining into group two." (In other words, "As soon as you run into a digit after a period, start group two.")
The IFERROR clause means, "If this pattern can't be found, just return the original cell data."
Assuming your content is in column A (Google Sheets), try this arrayformula in any cell other than column A:
=arrayformula(iferror(split(REGEXREPLACE($A:$A,"(\.)(\d+.+$)",char(6655)&"$2"),char(6655)),))
There are two regex groups denoted in ():
(\.) and (\d+.+$).
The first group looks for a dot . - it's escaped using \. The second group looks for a number (0-9) \d, one or more occurrences + then ending with $ one or more + of any character ..
The replacement is char(6655) (wouldn't usually be found in your dataset), and the contents of group two $2.
Then the split function divides the text into two columns by the char(6655) character.
iferror returns nothing if nothing is split.
The arrayformula works down the sheet.
I have a column in my excel that includes authors name and it looks as follows:
My goal is to remove the dates + the last comma from all of these rows to make it something like this:
Is there a way I can do it in excel?
Based on your example, in which there are multiple commas in one cell, I would go with determining the position of the last comma first (in order to know where to slice the content of said cell). Then it's a matter of IF formula based on condition in which the last 4 characters in the cell are digits:
=IF(ISNUMBER(VALUE(RIGHT(A1,4))),LEFT(A1,FIND("#",SUBSTITUTE(A1,",","#",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))))-1),A1)
FYI: The "#" substitution is targeted at knowing exactly where the last comma occurs in the cell. Any other unique, not-appearing-in-the-string character would have done the same job.
I've tested the formula on below examples:
Problem: I am working with 2 list. One called HYPHEN and one called CAS Number in columns A and B respectively.
Column C uses a formula that combines column A and B and sorts them such that if a hyphen is present in column A, this is inserted before the adjacent CAS number which is then inserted below and the sequence continues so that all hyphens and CAS numbers are included. I've attached an image to better explain this and the Formula to replicate this is given below.
A CAS number is a unique Identify for a material/chemical and usually is written as 000-00-0, however occasionally you get materials with CAS numbers of 0000-00-0 (or other variations).
For the most part column C is correct because all but one CAS numbers are in the usual format. However As highlighted in red 6132-04-3 is being converted to 1545801.
What I have tried:
I have realised that 6132-04-3 is being converted to 03/04/6132 so I'm pretty sure that this is being recognised as a date which is causing the problem. I have tried to format the cells to all be a text format, I have added a comma before the CAS number but nothing returns the desired value of 6132-04-3 and instead always returns 1545801.
To replicate the issue: Column A and B can have any data entered. To replicate the output of column C the formula is given below:
Formula for Column C:
=FILTERXML(""&SUBSTITUTE(TEXTJOIN(",",TRUE,A2:B26),",","")&"","//b")
(Formula provided by #Gary's Student on Stack Overflow)
Any thoughts on how to prevent the red CAS number being converted when it is sorted in Column C would be really appreciated.
This is a crude way to fix it by adding then removing an arbitrary character:
=MID(FILTERXML("<a><b>"&SUBSTITUTE(TEXTJOIN(",",TRUE,IF(A2:B26="","","x"&A2:B26)),",","</b><b>")&"</b></a>","//b"),2,99)
If you have the issue of some of your strings containing a comma, just use a different separator:
=MID(FILTERXML("<a><b>"&SUBSTITUTE(TEXTJOIN("|",TRUE,IF(A2:B26="","","x"&A2:B26)),"|","</b><b>")&"</b></a>","//b"),2,99)
Looks like you could use:
Formula in D2:
=SUBSTITUTE(FILTERXML("<t><s>'"&TEXTJOIN("</s><s>'",,A2:B10)&"</s></t>","//s"),"'","")
Or:
=MID(FILTERXML("<t><s>'"&TEXTJOIN("</s><s>'",,A2:B10)&"</s></t>","//s"),2,99)
I can suggest you this:
Go to Format Cells ---> Number ---> Custom ---> Type
In this "Type" field write this #000-00-0
Press "OK"
How to count comma separated specific values in a single cell in excel.
Suppose to found how many 15's are there in a single cell that contains 15,115,1515,15,215,15
I need the result 3.
Is there any formula in excel
One way is to compare the length of the original value with the length of the value after you've replaced all the 15s with a zero-length string, and divide that by 4 (which is the length of ",15,").
One important note... make sure to add a comma to the start and end of the original string to pick up leading and trailing 15s.
Here's what it would look like...