My Sheet look like this:
-ID Values
1. Name,Email,Company
2. Email,Name,Company
3. Company,Email,Name
-I would like to convert the data to name,email,company by condition of ID
Example Output:
1. Name Email Company
2. Name Email Company
3. Name Email Company
I need some assistance on this topic!! How I can do it?
You can get the ID Values to Example output like this assuming the ID Values are in A2:A4:
=split(A2,",")
=split(join(",",index(split(A3,","),1,2),index(split(A3,","),1,1),index(split(A3,","),1,3)),",")
=split(join(",",index(split(A4,","),1,3),index(split(A4,","),1,2),index(split(A4,","),1,1)),",")
Put this in C2:.
=arrayformula(SPLIT(B2:B5,","))
If B2:B5 has comma separated values,C2 will give you the answer
Try split and sort:
=TRANSPOSE(SORT(TRANSPOSE(SPLIT(A1,","))))
used double TRANSPOSE because sort works for vertical arrays only.
Related
I plan on creating a remarks column within my sheet, and I want it to be such that whenever I update one side or the other, it will merge the remark and remove any duplicates within it.
Would appreciate if anyone has any inputs on this.
Example:
Remarks in the column of one google sheet:
-Friendly -Fun
Remarks in the other column of another google sheet :
-Friendly -Cheerful
So my google script will get the string in both columns, I would like to make the end result of the string to be :
-Friendly -Cheerful -Fun
Can you try like this to what I understand and see attached image as will
=Unique(Transpose(Split(TEXTJOIN(" ",True,B2,D2),"-",True)),False,False)
I'm trying to learn JSON path and I'm using the sample at https://codebeautify.org/jsonpath-tester# to practice.
I'm trying to extract the id based on the employee's first name as below:
$.employees.employee[?(#firstName='Tom')].id
However it returns all the ids. How do I pick the id based on firstName?
try: $.employees.employee[?(#.firstName == 'Tom')].id
You are missing #.firstName and ==
Someone at my organization created a MySQL column with values that look like this:
[
{"name1":"value1"},
{"name2":"value2"},
{"name3":[
{"subname3.1":["subvalue3.1.1","subvalue3.1.2"]},
{"subname3.2":["subvalue3.2.1","subvalue3.2.2"]},
{"subname3.3":["subvalue3.3.1","subvalue3.3.2"]}
]},
{"name4":"value4"}
]
The actual names vary from row to row, as do the number of array elements, but no name is repeated within a single row, and no subname is repeated within a single name within a single row.
I need the list of values ["subvalue3.1.1","subvalue3.2.1","subvalue3.3.1"] in that order. But note that name3 is not always third: its position varies: so I need to access it by name (name3).
I don't see anything at https://dev.mysql.com/doc/refman/5.7/en/json-functions.html that will find it for me.
Can anyone help, please?
It's
col->>"$**.name3[*].*[0]"
This assumes that name3 doesn't appear elsewhere as a name.
I have a table with "content" column store forum post, there is one or more url in one record of "content" field, I want to get all the url in the “content" column, one url in one row, I use below code
select substr(`content`, locate(`content`,"http://"))
it work for one url in one record, get a list of url like
http://www.google.com
http://www.facebook.com
...
it only get the first url if there are more than one url in the record.
how to fix it?
Another way to look at it is to try:
SELECT GROUP_CONCAT(substr(`content`, locate(`content`,"http://"))) FROM your_table;
which would concatenate all URLs to a single string and carry on from there - maybe you can split it in the code rather than require the DB to do it. Otherwise you can hack on using an auxiliary table of integers 1-n: SQL split comma separated row
I have a text file that looks something like...
firstname:middle:lastname
firstname:middle:lastname
firstname:lastname
firstname:middle:lastname
firstname:lastname
I would like to be able to eventually use this information in a MySQL database, but since the columns are not correct I am not sure what to do. Is there any way to resolve this?
If the data you have is only the above variations, then you can make the assumptions:
First part is the firstname
Last part is the lastname
Therefore if using PHP for example you could use explode to separate the data on the delimeter such as in this case being :.
When looping through each row just assume the last part is the lastname, first part is the firstname and the middle part is the middlename.
You can use count() to find out how many parts are in the specific row you are reading inside the loop. This should allow you to figure out which one is the last part.
If the file is so simple ... the solution is trivial
firstname:middle:lastname
firstname:lastname
if(there are only two columns) { that means we have first and last name }
else { we have first, middle and last name }
If there are more columns, you could maybe resolve data to proper columns if you manage to build a priority list (like in what order they could be missing, for example 'last name > first name > middle name') or/and if you could combine that with data type matching (string/int/double/date) ... anyway you need to gather all your domain knowledge and see if that suffice.