Formula to separate text between delimiters in string field in BigQuery - sql

I have the following field:
XYZASDF543::DFKEINFBJI65::ORFN6849
I need an SQL formula in BigQuery that can give me text between delimiters:
DFKEINFBJI65
Any ideas? Thanks!
There are lots of fields like this in my dataset, and numbers of symbols are not the same in each field, so I can't use left or right function.

Related

Manipulating data after styling

I am totally new to python/pandas and trying to do a simple task of splitting a text field (delimited by commas) in a dataframe into multiple columns where the comma is the delimiter. The file is originally in Excel. The field is not left justified, so I left justify it using the following command:
df=df.style.set_properties(**{'text-align': 'left'})
This command does left justify the column, but it also transforms the dataframe into a Styler object, which then doesn't allow me to execute commands that I normally would on a dataframe. I did use the df=df.data command after the transformation, and that does seem to change it back to a dataframe, but the field reverts back to a right justified column. Thanks for any assistance.

Find rows with the duplicate string data

I have a scenario like this where this particular column "workData" has some JSON in string form. I have to find records where Text is either empty or the Text of both objects are same. For the empty string case I can apply a where clause as WHERE workData not like '%"Text":""%' but I am clueless as to how to do the second part. Assume the table name as "workforce".
Any help will be highly appreciated.

SQL column with email body and chart conversations with lot of spaces - how to clean

I have a SQL query outputting a column which contains data from emails and chart conversations with lot of spaces, special characters, how can I clean and make this data show up in one row so that I could save the table output into a CSV file.
PS: the query output is in millions.
This could help. Instead of the space character use just empty quotes as the third parameter.

Multiple substitue or replace text in excel using a table

I'd like to create a super substitute function in excel (if there is such a thing). For my needs, nesting is insufficient because my substitution list is long.
What I'd like to do is have a named table with two columns for the function to use as a look-up for potential substitutions. The first column would contain the original text and the second would contain the replacement text.
If we look at the above example, the columns R and S consists of my table, with column R as the original text that I wanted replaced with the equivalent row entry in column S, if found in my list. My data in column V is the list that I want to work on. I want the formula in column W to look at the equivalent entry in column V and lookup in the table for any matches within the text. If there is a match, then I want that text from column R replaced with the text in column S. In some cases there can be 2 matches, as with the top example of 'LHR:JFK' which should ideally get replaced to 'LON:NYC'.
There are ways to do this with VBA but I would like to know if there is an Excel formula option for the same as I don't know where to begin with VBA.
Your help is greatly appreciated.
Thanks,
Neha
This will do as you ask:
=SUBSTITUTE(SUBSTITUTE(V2,LEFT(V2,3),IFERROR(VLOOKUP(LEFT(V2,3),R:S,2,FALSE),LEFT(V2,3))),RIGHT(SUBSTITUTE(V2,LEFT(V2,3),IFERROR(VLOOKUP(LEFT(V2,3),R:S,2,FALSE),LEFT(V2,3))),3),IFERROR(VLOOKUP(RIGHT(SUBSTITUTE(V2,LEFT(V2,3),IFERROR(VLOOKUP(LEFT(V2,3),R:S,2,FALSE),LEFT(V2,3))),3),R:S,2,FALSE),RIGHT(SUBSTITUTE(V2,LEFT(V2,3),IFERROR(VLOOKUP(LEFT(V2,3),R:S,2,FALSE),LEFT(V2,3))),3)))

Query in Google Spreadsheet

I made a simple query function as this: =QUERY(range,"select *",1), in my Google Spreadsheet, but the results dose not show any letters, it shows only fields that contains numbers.
Study this link
Syntax
QUERY(data, query, [headers])
data - The range of cells to perform the query on.
Each column of data can only hold boolean, numeric (including
date/time types) or string values.
In case of mixed data types in a single column, the majority data type
determines the data type of the column for query purposes. Minority
data types are considered null values.
Just format your range as a plain text using Format > Number > Plain text option, the below images show how to do it: