Extract column value using REGEXEXTRACT with ARRAYFORMULA - regex

I have a column in Google Sheets with values like 1(current), 2(current), etc. I am getting these values from google form response.
I want to extract only the integer from cell value as 1,2,3.. so on.
I am able to use SPLIT(A2, "(current)") for cells. But this does not get applied for new values from form response.
I found that ARRAYFORLMULA can be used for applying a formula to new responses from forms, but somehow it isn't working. I tried them as mentioned below, but I am not sure if I am using it correctly.
=ArrayFormula(QUERY( SPLIT(E2:E,"(current)")))
=ArrayFormula(SPLIT(E2:E,"(current)"))
Can someone help with how to achieve above answer with REGEXEXTRACT?

try like this:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(E2:E, "\d+")))

Related

Data validation for time input in Google Sheets

I am searching for a solution that would allow users to insert time values only in this format: hh:mm, and reject if something else is inserted. Something similar like data validation for date - Data validation -> Is valid date -> Reject input.
I tried to search and adjust a Regexmatch formula for this one, with no success, but I am open for other suggestions also.
Thank you in advance!
SUGGESTION
Perhaps you can try using a more specific regex such as the one sample from this existing post. Then, apply it your data validation via a custom function using REGEXMATCH function as seen here:
=REGEXMATCH(TO_TEXT(A1),"^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$")
Sample Data Validation Config:
Demo:
E.g. Any text or date formats won't be accepted.
use custom formula:
=REGEXMATCH(""&A1; "\d{2}:\d{2}")
if you want to block inputs like: 75:99 then try:
=REGEXMATCH(""&A1; "\d{2}:\d{2}")*((A1*1)<=1)

I want to turn this if formula into an array formula but cant seem to get it to auto populate down the rows

I want the driving distance between two address's and I am running a script that allows the following statement work.
This works but I have to drag the formula down when new rows are added from my mobile app into my sheet
=(IF(ISBLANK($AF2:$AF),"",DrivingMeters($E2:$E,$AF2:$AF)/1000))
This doesn't work
=ARRAYFORMULA(IF(ISBLANK($AF$2:$AF),"",DrivingMeters($E$2:$E,$AF$2:$AF)/1000))
I cant work out what I am doing wrong?
it could possible be you need to adjust your DrivingMeters custom formula to accept arrays. Please share the sheet or custom formula
try:
=ARRAYFORMULA(IF(AF2:AF="",, DrivingMeters(E2:E, AF2:AF)/1000))

Google Sheets Array formula for counting the number of values in each column

I'm trying to create an array formula to auto-populate the total count of values for each column as columns are added.
I've tried doing this using a combination of count and indirect, as well as tried my hand at query, but I can't seem to get it to show unique value counts for each column.
This is my first time attempting to use query, and at first it seemed possible from reading through the documentation on the query language, but I haven't been able to figure it out.
Here's the shared document: https://docs.google.com/spreadsheets/d/15VwsL7uTsORLqBDrnT3VdwAWlXLh-JgoJVbz7wkoMAo/edit?usp=sharing
I know I can do this by writing a custom function in apps script, but I'd like to use the built-in functions if I can for performance reasons (there is going to be a lot of data), and I want quick refresh rates.
try:
=ARRAYFORMULA(IF(B5:5="",,TRANSPOSE(MMULT(TRANSPOSE(N(B6:99<>"")), SIGN(ROW(B6:99))))))
In B3 try
=ArrayFormula(IF(LEN(B5:5), COUNTIF(IF(B6:21<>"", COLUMN(B6:21)), COLUMN(B6:21)),))

Creating a formula using INDEX and IF

I want to create a formula where I take the newest value on a cell. The information is updated when someone fills out the Google Form. Basically, there is some information the customer might not fill out, so the information is sparse.
What I want to create is a formula where it always takes the very bottom value of the spreadsheet (newest information). Even if the cell was blank, I want it to output as blank, and if there is an information on that cell, output it as that written value. Is this possible using INDEX and IF formula? Or is there some other formula to solve this problem.
If this doesn't make sense, please comment and I'll answer.
=INDEX(A:A, COUNTA(A:A))
let form sheet be:
then to get last form entry row use:
=ARRAYFORMULA(INDIRECT("form!"&
MAX(IF(form!A:A<>"", ROW(form!A:A), ))&":"&
MAX(IF(form!A:A<>"", ROW(form!A:A), ))))

How can I use ArrayFormula within a formula containing Vlookup, Filter and RegexMatch

I'm making a Google Spreadsheet which checks if a Value in Column A contains keywords out of a List in Column F. Problem is that I want to check if the value in A is exactly the same OR partly the same.
With a lot of help i've found over here I created this working formula:
=VLOOKUP(FILTER(ArrayFormula((LOWER(F:F)));REGEXMATCH(LOWER(A2);ArrayFormula((LOWER(F:F)))));ArrayFormula((LOWER(F:G)));1;FALSE)
Because I automatically import new lines of data I want to use ARRAYFORMULA. Unfortunately, I can't get it done.
This are my working formulas:
=VLOOKUP(FILTER(ArrayFormula((LOWER(F:F)));REGEXMATCH(LOWER(A2);ArrayFormula((LOWER(F:F)))));ArrayFormula((LOWER(F:F)));1;FALSE)
=VLOOKUP(FILTER(ArrayFormula((LOWER(F:F)));REGEXMATCH(LOWER(A3);ArrayFormula((LOWER(F:F)))));ArrayFormula((LOWER(F:F)));1;FALSE)
You can find my spreadsheet over here:
https://docs.google.com/spreadsheets/d/1aIdQ65SdeXW-4cTr8azQIiLNGcRCvTexGS_lFu8mECs/edit#gid=1308644379
=ARRAYFORMULA(PROPER(IFERROR(REGEXEXTRACT(LOWER(A2:A); LOWER(TEXTJOIN("|"; 1; F2:F))))))