Is there a way to use the data-splitting function for different types of separators at the same time? - arrays

Working with a data sheet with phylogenetic data. Trying to separate information out of it. Problem is it's all in one cell and for me to manually double click, highlight part of the cell I need, copy, double click my spreadsheet, and paste into it would be really painful. Trying to separate to columns so I can just copy/paste from one spreadsheet to another.
So it'll look like this in one cell:
cervical vertebrae, postzygapophysis, contact anteriorly: absent(0); present but looks weird (1)
I want it to look like, in one row:
cervical vertebrae | postzygapophysis | contact anteriorly | absent(0) | present but looks weird(1)

If you look at HELP or the pop-up when you enter the Split function in sheets, you will see that [split_by_each] is an option. When set to TRUE it will split by each character in the delimiter argument.
So, in your case:
=split(A1,",:;",true,true)

What you are looking for in Googlesheet is split:
Basically, for a single separator, you can simply do:
=split(Cell,",")
But for multiple separators like yours, put all the separator together:
=split(Cell,"separators")
For example, say in Cell A1 you put your dirty string there,
cervical vertebrae, postzygapophysis, contact anteriorly: absent(0); present but looks weird (1);
In cell B2, or any other cell, you can type: =split(Cell,",;:")
If you need to trim out white spaces if present, then you can use this instead:
=ArrayFormula(trim(split(A1,",;:")))

for one row (as mentioned):
=SPLIT(A1; ",;:")
for array use:
=ARRAYFORMULA(IFERROR(SPLIT(A1:A; ",;:")))

Related

Place plaintext right beside variables (without whitespace) in VS Code User Snippets

I would like to create a User Snipper in VS Code that is a combination of variables and plaint text. This can typically be achieved by combining variables and plain text with a whitespace between then. But I would like to ad a variable next to a text without a whitespace.
For Example, I would like to create the current timestamp like this:
2022-02-19T21:02:24-0530
Below is what I tried
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATET$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Notice the T in between $CURRENT_DATE & $CURRENT_HOUR
OUTPUT:
2022-02-CURRENT_DATET21:06:12-0530
You can add $ symbol before the plain-text you want to add.
In this case, you need at add $T instead of T
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE$T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Note that $T will get considered as a placeholder, and it will be the last item selected while tabbing through the inserted snippet.

Excel IRR: Can I use range reference inside IRR with math inside {}?

Good morning. In post "Excel IRR: can I use it referencing a combination of cells and fixed numbers? IRR({-10,11+A2})" is said we can math inside {} using CHOOSE function. But if I have first payment (investment) in B1, 100, and rest of income in a range, B2:B6, (10,10,10,10,70), then, when I try
=IRR(CHOOSE({1,2};-B1,E2:E6))
I receive a #¡VALUE! result with ENTER or CSE. I use an spanish version of Excel 2013, where separator is ";" instead ",". I have try
=IRR(CHOOSE({1,2};(-B1,E2:E6)))
without success. Ideally I would like make some additional calculations in first cell, for example -B1+cell1+cell2 ...
Thank in advance

Using CONCATENATE in a MATCH Function

So I'm creating a Hyperlink that will go to a specific Tab. There are multiple tabs.
=HYPERLINK(CONCATENATE("#","'",G3,"'","!E")&MATCH(E3,CONCATENATE("'",G3,"'","!E:E"), FALSE),"GO")
The first CONCATENATE works, but the 2nd one in the MATCH function returns "'G3'!E:E" and results in a #VALUE! error.
The reason I need it to go to G3 is that's the Tab Name I want it to go to. Different lines will go to different tabs and I'm trying to make it automatically populate with the Tab Name.
Help! And Thanks in Advance!
~Michelle
Though HyperLink accepts a string, MATCH does not. So you need to use INDIRECT in the MATCH to turn the string into a viable range reference:
=HYPERLINK(CONCATENATE("#","'",G3,"'","!E")&MATCH(E3,INDIRECT(CONCATENATE("'",G3,"'","!E:E")), 0),"GO")

PhpStorm editing multiple selection

I'm wondering about way to edit multiple selections but with different texts
For example:
arr=['hi','i','am','your','array','can','change','me','quickly','please']
arr=['test1','text','foo','test','fast','yes','test2','test3','text2','text3']
I have array of ten elements and I want to change them all with different texts.
Ordinary way to select one then change it. If you use multiple selections all of them are replaced with the same new text.
The question there: any way to change them faster?
I think there may be a way to change it like Emmet in HTML when you enter Emmet code PhpStorm convert it and take you inside red box in each element to write inside it one by one.
i have found the solution to make it easily to edit the array
just using the find ctrl+f and then use f3 to get next value to edit
in the search we can enter the regular expression that will find any matched values
(?<=')\w+(?=')|(?<=,)\w+(?=,)|(?<=\[)\w+(?=,)|(?<=,)\w+(?=])
(?<=')\w+(?=') : any text inside single quotes symbol ' can be changed double "
(?<=,)\w+(?=,): any word between commas for numbers and variables in the array
(?<=\[)\w+(?=,): the first element of the array if it as number or variable
(?<=,)\w+(?=]) : the last element in the array if it as number or variable
| : or operator

Issue reading .txt file in Matlab. I want to get an array from this file without the unnecessary info it contains

I'm having trouble reading a .txt file to get some data. I want to be able to change some of the values this data contains.
At first, I used this:
A=importdata('myfile.txt');
And got this cell array:
Now what I want is this:
1) Get rid of the headers (the information from cell 1 to 22). That could be easily done by simple indexing (creating a sub-array using just the info from cell 23 to the end of the file).
2) I want to separate the information into different cells, using these identifiers. But I don't know how to separate them into different cells of the array.
'# item bepoch ecode label onset diff dura b_flags a_flags enable bin'
3) Do the same in step 2 to fill those columns with the data in the rest of the cells.
I'm trying to use this approach, but I'm not getting the expected results.
If someone can help me, I'd be glad.
Have you tried dragging the file into the variable workspace window and using the data import wizard? It has some nice features that normally take care of what you are trying to do automatically. Unfortunately, it seems that your text file may have unconventional spacing, but Matlab may be able to handle it if you set the delimeter to ' ' or suchlike.

Resources