Sorting alphanumeric text as alphabetically in Google Sheet - sorting

I have a Google Sheel Which Have alphanumeric text, as Can be seen in Picture
![Text]
(https://i.stack.imgur.com/lUs91.png)
I Want To sort All Rows with Custom Sort List as ("Wireless", "Landline", "VOIP"),
I tried following Function
'''
=LET(X,TOROW(A1:D1,1),SORTBY(X,FIND(MID(X,18,1),"WLV"),,X,))
'''
but it's Show Error
This error can be seen in this google sheet
https://docs.google.com/spreadsheets/d/1JbAsmYnqnr3WZ1-NJ_vhT-W6tTYqt7hmjQe_-aTrJlU/edit?usp=drivesdk
Please tell me the complete solution.
Make changes to the same Google Sheets if possible

Put this formula in a free range in Sheet2, such as cell Sheet2!AA2:
=transpose(
sort(
transpose(L2:V2),
9 * regexmatch(transpose(trim(L2:V2)), "(?i)wireless"), false,
7 * regexmatch(transpose(trim(L2:V2)), "(?i)landline"), false,
5 * regexmatch(transpose(trim(L2:V2)), "(?i)voip"), false,
1 * regexmatch(transpose(trim(L2:V2)), "(?i)."), false
)
)
You can hide columns L:V, or replace their contents with the formula results by using copy and Edit > Paste special > Values only.

Related

Google sheets adding an IF statement

I have the following formula in google sheets that returns the relevant cell value. I want to expand it for something else to to return a 1 if the cell is not blank, and 0 if it's blank:
=INDIRECT("'"&B$1&"'!g17")
Try this:
=IF(INDIRECT("'"&B$1&"'!g17")="",0, 1)

How do I do fill down with formula in reverse order in Google Sheet

When I fill down with formula starting with, say, =A9, it will auto fill with =A10, =A11, A=12, in incrementing order. But I want it to fill down in reverse order as =A8, =A7, =A6, how do I do that? In Excel, I can select 2 cells, =A10 and =A9, Excel will know to fill in reverse order.
You could use the SEQUENCE function within the formula
=SEQUENCE(7,1,11,-1)
or even as
=SEQUENCE(7,1,11,-1)
EDIT
If you need to reverse the order of already existing values in cells you can use:
=SORT(A1:A9,ROW(A1:A9),0)
or even the following to exclude empty rows
=SORT(A1:A9,ROW(A1:A9)*N(A1:A9<>""),0)
try like this:
=SORT(ROW(A:A), 1, 0)
or if you want from 10 to 5
=SORT(ROW(A5:A10), 1, 0)
or to flip the column values:
=SORT(A9:A15, ROW(A9:A15)*N(A9:A15<>""), 0)

Entrez E-Search results not matching up with online results

I am using the code below to perform an esearch, but the IDs that I get from IdList are not matching up with the IDs on the online search.
from Bio import Entrez
Entrez.email = "myEmail#gmail.com"
handle = Entrez.esearch(db = "nucleotide", term = "chordata[orgn] AND
chromosome", retmax = 10, idtype = "acc")
genome_ids = Entrez.read(handle)['IdList']
print(genome_ids)
When I print the id's out they don't match up with the ones online.Does anyone know why? These are the id's I get when I print out genome_ids:
['NG_017163.2', 'NM_017553.3', 'NG_059281.1', 'NM_005101.4',
'MH423692.1', 'MH423691.1', 'MH423690.1', 'MH423689.1', 'MH423688.1',
'MH423687.1']
Here is the link to the online search:
https://www.ncbi.nlm.nih.gov/nuccore/?term=chordata%5Borgn%5D+AND+chromosome
Also does anyone know how I can download the chromosomal and mitochondrial genome of all the organisms from the chordata phylum.I want to do it using BioPython through the E-utilities.
How I can download the chromosomal and mitochondrial genome of all the organisms from the chordata phylum
Go to https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi
Enter chordata in the 'search for' box, select complete name in the dropdown list
Enter a high number for the levels (e.g. 30), and select the filter has genome sequence in the dropdown list
Check the nucleotide checkbox
You will now view a full taxonomic tree of the chordata with its subtaxa. The number behind each taxid is the number of sequences for that taxid. So, NCBI contains 84,366,537 different sequences of chordata.
You probably don't have enough space to download them all, so make a selection, click on the number behind the taxid, and choose Send to > File > FASTA.

How can I locate items using xpath from below elements?

I've created some xpath expressions to locate the first item by it's "index" after "h4". However, I did something wrong that is why it doesn't work at all. I expect someone to take a look into it and give me a workaround.
I tried with:
//div[#id="schoolDetail"][1]/text() --For the Name
//div[#id="schoolDetail"]//br[0]/text() --For the PO Box
Elements within which items I would like the expression to locate is pasted below:
<div id="schoolDetail" style=""><h4>School Detail: Click here to go back to list</h4> GOLD DUST FLYING SERVICE, INC.<br>PO Box 75<br><br>TALLADEGA AL 36260<br> <br>Airport: TALLADEGA MUNICIPAL (ASN)<br>Manager: JEAN WAGNON<br>Phone: 2563620895<br>Email: golddustflyingse#bellsouth.net<br>Web: <br><br>View in AOPA Airports (Opens in new tab) <br><br></div>
By the way, the resulting values should be:
GOLD DUST FLYING SERVICE, INC.
PO Box 75
Try to locate required text nodes by appropriate index:
//div[#id="schoolDetail"]/text()[1] // For "GOLD DUST FLYING SERVICE, INC."
//div[#id="schoolDetail"]/text()[2] // For "PO Box 75"
Locator to get both elements:
//*[#id='schoolDetail']/text()[position()<3]
Explanation:
[x] - xPath could sort values using predicate in square brackets.
x - could be integer, in this case it will automatically be compared with element's position in this way [position()=x]:
//div[2] - searches for 2nd div, similar to div[position()=2]
In case predicate [x] is not an integer - it will be automatically converted to boolean value and will return only elements, where result of x is true, for example:
div[position() <= 4] - search for first four div elements, as 4 <= 4, but on the 5th and above element position will be more than 4
Important: please check following locators on this page:
https://www.w3schools.com/tags/ref_httpmessages.asp
//table//tr[1] - will return every 1st row in each table ! (12 found
elements, same as tables on the page)
(//table//tr)[1] - will return 1st row in the first found table (1 found element)

LotusScript: how to iterate numbered fields with for loop

I'm using LotusScript to clean and export values from a form to a csv file. In the form there are multiple date fields with names like enddate_1, enddate_2, enddate_3, etc.
These date fields are Data Type: Text when empty, but Data Type: Time/Date when filled.
To get the values as string in the csv without errors, I did the following (working):
If Isdate(doc.enddate_1) Then
enddate_1 = Format(doc.enddate_1,"dd-mm-yyyy")
Else
enddate_1 = doc.enddate_1(0)
End If
But to do such a code block for each date field didnt feel right.
Tried the following, but that isnt working.
For i% = 1 To 9
If Isdate(doc.enddate_i%) Then
enddate_i% = Format(doc.enddate_i%,"dd-mm-yyyy")
Else
enddate_i% = doc.enddate_i%(0)
End If
Next
Any suggestions how to iterate numbered fields with a for loop or otherwise?
To iterate numbered fields with a for loop or otherwise?
valueArray = notesDocument.GetItemValue( itemName$ )
however do you know that there is a possibility to export documents in CSV format using Notes Menu?
File\Exort
Also there is a formula:
#Command([FileExport]; "Comma Separated Value"; "c:\document.csv")
Combined solution of Dmytro, clarification of Richard Schwartz with my block of code to a working solution. Tried it as an edit on solution of Dmytro, but was rejected.
My problem was not only to iterate the numbered fields, but also store the values in an iterative way to easily retrieve them later. This I found out today trying to implement the solution of Dmytro combined with the clarification of Richard Schwartz. Used a List to solve it completely.
The working solution for me now is:
Dim enddate$ List
For i% = 1 To 9
itemName$ = "enddate_" + CStr(i%)
If Isdate(doc.GetItemValue(itemName$)) Then
enddate$(i%) = Format(doc.GetItemValue(itemName$),"dd-mm-yyyy")
Else
enddate$(i%) = doc.GetItemValue(itemName$)(0)
End If
Next

Resources