Apply formula for rows with first occurence of text - if-statement

I want to achieve something like the image below:
How can I do it?

use this formula:
=ARRAYFORMULA(IF(COUNTIFS(A:A, A:A, ROW(A:A), "<="&ROW(A:A))=1,
"first occurance", ))

Looks like this normal Excel formula works just fine.
Assuming your data starts from cell A1, insert following formula
=IF(COUNTIF($A$1:A1,A1)=1,"First Occurrence","")
Then copy down as much as you need.

Related

Google Sheets ARRAYFORMULA to skip blank rows

How to make my ARRAYFORMULA(A1 + something else) to stop producing results after there are no more values in A1 column, eg. to skip blank values. By default it gives endlessly "something else".
Here is my demo sheet:
https://docs.google.com/spreadsheets/d/1AikL5xRMB94BKwG34Z_tEEiI07aUAmlbNzxGZF2VeYs/edit?usp=sharing
Actual data in column A1 is regularly changing, rows are being added.
I tried the others and they didn't work. This does though:
=ARRAYFORMULA(filter(A1:B;A1:A<>"";B1:B<>""))
use:
=ARRAYFORMULA(IF(A1:A="";;A1:A+1000))
You can try this formula =ARRAYFORMULA(IF(ISBLANK(A1:A),"",(A1:A + B1:B))) if this works out for you.
Reference:
https://support.google.com/docs/answer/3093290?hl=en

Any ideas on Iterating over dataframe and applying regex?

This may be a rudimentary problem but I am new to pandas.
I have a csv dataframe and I want to iterate over each row to extract all the string information in a specific column through regex. . (The reason why I am using regex is because eventually I want to make a separate dataframe of that column)
I tried iterating through for loop but I got ton of errors. So far, It looks like for loop reads each input row as a list or series rather than a string (correct me if i'm wrong). My main functions are iteritems() and findall() but no good results so far. How can I approach this problem?
My dataframe looks like this:
df =pd.read_csv('foobar.csv')
df[['column1','column2, 'TEXT']]
My approach looks like this:
for Individual_row in df['TEXT'].iteritems():
parsed = re.findall('(.*?)\:\s*?\[(.*?)\], Individual_row)
res = {g[0].strip() : g[1].strip() for g in parsed}
Many thanks in advance
you can try the following instead of loop:
df['new_TEXT'] = df['TEXT'].apply(lambda x: [g[0].strip(), g[1].strip()] for g in re.findall('(.*?)\:\s*?\[(.*?)\]', x), na_action='ignore' )
This will create a new column with your resultant data.

Thickbock data validation in googlespreadsheet how to return multiple values

I created a googlespreadsheet here: https://docs.google.com/spreadsheets/d/1K5oc6-XcgMTUSCICr9GguxHWkrm1UuMhnzXu9Rn3ngY/edit?usp=sharing
I would like to return values from all the "checked" thickboxes in a single row like the image below.
Can I do this using a formula?
use:
=ARRAYFORMULA(REGEXREPLACE(""&TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(A2:C=TRUE,
{A1&",", B1&",", C1}, )),,9^9))), ",$", ))
While it can be done in an arrayformula for the whole column, you might try this simple JOIN() formula, dragged down the column. Starting in D2:
=IFERROR(JOIN(", ",FILTER(A$1:C$1,A2:C2)))

how to extract number sets in parentheses from Google sheet

How to extract and split this set of numbers (314.81+10.00)+0.00 to each column
expected result:
Try in W1
=ARRAYFORMULA(value(split(regexreplace(V1, "\(|\)",), "+")))
and see if that works?
like this:
=SPLIT(REGEXREPLACE(A1, "\(|\)", ), "+")
and ArrayFormula would be:
=ARRAYFORMULA(IFERROR(SPLIT(REGEXREPLACE(A1:A, "\(|\)", ), "+")))
Well, in for a penny, in for a pound.
=split(substitute(substitute(A2,"(",""),")",""),"+",1,1)
You need to format the fields as "0.00".

Highlighting a whole row if number of blank cells in the row = a certain number

I'm trying to highlight a row if the number of blank cells between say, C1 and E1 = 3
and then copy this down for every row.
I've tried using:
=IF(COUNTBLANK($C1:$E1)=3)
But it's not working, can anybody help?
Under conditional formatting, your formula should be the following based on what you've given. The reason is conditional format is trying to see the result as TRUE or False. The IF statement is trying to tell the computer what to do when it's TRUE or FALSE.
COUNTBLANK($C1:$E1)=3
if you want to use IF you will need to do it like this:
=IF(COUNTBLANK($C1:$E1)=3, 1)