Get cell from a dynamic table in google sheets - google-sheets

Google sheet outputs a table when using googlefinance
Let's take an example for that
=GOOGLEFINANCE("NASDAQ:GOOG", "price", date(2020,1,1))
I want to get just value from this table. I know this forumula can give me multiple rows. But I still just want to get value of just one cell, in this example I want value of second row second column i.e. 1367.37 only.

use:
=INDEX(GOOGLEFINANCE("NASDAQ:GOOG", "price", DATE(2020, 1, 1)), 2, 2)

Related

How to update data in a Google sheet depending upon another sheet?

I need to update a cell with a defined value automatically by comparing and referencing this data from another Google sheet.
In Sheet1 Column_C is to be updated by comparing Column_A in Sheet1 to Column_A in Sheet2.
If it is a match, and Column_B's value from Sheet2 is 1, then the result should be "issued", otherwise it should be "in-stock".
Sharing google sheet link :
https://docs.google.com/spreadsheets/d/1h_D5u16ye1CA6C7dideJVZoV8cBvZB8M3RRxXBANsf4/edit?usp=sharing
How can I accomplish this using Google Sheets?
Try this in cell C1 (delete all other values below):
=arrayformula({"Status";if(A2:A<>"",substitute(substitute(iferror(vlookup(A2:A,filter(sheet2!A:B,countifs(sheet2!A:A,sheet2!A:A,row(sheet2!A:A),">="&row(sheet2!A:A))=1),2,0),),1,"Issued"),0,"In-Stock"),)})
To handle items in sheet1 that are not in sheet2, you can add a value in the iferror function (the first "In-Stock" below):
=arrayformula({if(A2:A<>"",substitute(substitute(iferror(vlookup(A2:A,filter(sheet2!A:B,countifs(sheet2!A:A,sheet2!A:A,row(sheet2!A:A),">="&row(sheet2!A:A))=1),2,0),"In-Stock"),1,"Issued"),0,"In-Stock"),)})
This is responsible for getting the dataset from sheet2:
filter(sheet2!A:B,countifs(sheet2!A:A,sheet2!A:A,row(sheet2!A:A),">="&row(sheet2!A:A))=1)
This part gets the instance number of each duplicate value in sheet2!A:A:
countifs(sheet2!A:A,sheet2!A:A,row(sheet2!A:A),">="&row(sheet2!A:A))
Where there are duplicate values, ">=" gets the one furthest down the sheet. Changing it to "<=" will get the first instance at the top of the sheet.
Within filter, countifs(sheet2!A:A,sheet2!A:A,row(sheet2!A:A),">="&row(sheet2!A:A))=1) filters the column to show just 1 instance of each value in sheet2!A:A.
Looking at your example sheet, you have these values in row 6, 7, 8, so the first instance (ascending or descending) will be 0:
1230E 0
1230E 1
1230E 0
If you're looking for a different logic, like 1 trumps 0, then you'll need to apply a sort on the data before performing the vlookup. Something like:
=arrayformula({if(A2:A<>"",substitute(substitute(iferror(vlookup(A2:A,unique(sort(sheet2!A2:B,1,1,2,0)),2,0),"In-Stock"),1,"Issued"),0,"In-Stock"),)})

Incrementing a column in a group using an Array Formula in Google Sheets

I am having difficulties trying to get an array formula to increment a column and restart the increment whenever a condition has been met.
Here is an example of what I am trying to achieve, but this has been done manually. It would be great if this could work in an array formula as we'll be adding more rows and would rather not drag the formula down.
[Update based on feedback of the original post]
Column A contains a list of names and teams.
Names are already organised into teams.
The aim is to go through each row and provide a name with an index starting from 1.
Then when a new team is found in column A the index starts again from 0.
The aim is to make this an Array Formula to avoid having to manually re-add the formula when more rows are added.
Link to sheet:
https://docs.google.com/spreadsheets/d/1K00LRFNrN99fFXQO1tzp8jjZeCuTxwENXNGuLj0K0ao/edit?usp=sharing
Example
Any thoughts or advice on this would be greatly appreciated.
I've added a new sheet ("Erik Help") to your sample spreadsheet. It contains the following formula in B1:
=ArrayFormula({"ID Index"; IF(A2:A="",, IF( REGEXMATCH(LOWER(A2:A),"team"), 0, ROW(A2:A) - VLOOKUP(ROW(A2:A), FILTER(ROW(A2:A), REGEXMATCH(LOWER(A2:A),"team")), 1, TRUE)))})
The header text is included in the formula. You can change it as you like.
If a cell in A2:A is blank, the corresponding cell in B2:B will be as well.
If REGEXMATCH finds a match with "team" in the lowercase rendering of a cell in A2:A, 0 will be returned for the corresponding cell in B2:B.
Otherwise, VLOOKUP will lookup each remaining row number in a FILTERed array containing only those row numbers where the word "team" appears. (In your sample set, that will be 2, 8, 12). When the exact match is not found (which it will not be for any remaining row), TRUE tells VLOOKUP that, since the search array is in strict ascending order, we want it to "bump back" to the most recent value found. In each case, the returned row number of the most recent row containg "team" is then subtracted from the actual row number to produce the recurring incremental numbering 1, 2, 3, etc.
try:
=INDEX(IFNA(1*IF(REGEXMATCH(A2:A, "Day"), 0, REGEXEXTRACT(A2:A, "(\d+)"))))

How to get data from concatenated strings in one cell to another table in Google Sheets?

for my use case, I have a Google survey that is connected to a main Google Sheet.
The survey has a 2 questions: 1. Name, 2. Multiple Choice from 1-31 (days of a month).
My survey results come into a by Google survey/Forms automatically generated table in Google Sheets with 2 columns: 'Name', and 'Which days?'. The 'Which Days?' column is has cells with a concatenated list of strings (e.g. '1, 3, 6, 8, 11').
The main Google Sheet has following structure: The first column is 'Name' that just imports the name from the Typeform Sheet (this works fine).
The remaining columns represent the days of the month (so up to 31 columns from 1-31).
Under each column, there are checkboxes.
The idea is that the checkboxes will automatically check according to the results from the Typeform (instead of checkboxes, we could also use colored cells if that is easier).
The problem:
How can I automatically get the data from the concatenated cell 'Which Days?' (e.g. '1, 3, 6, 8, 11') to the main Google Sheet (so that columns '1', '3', ..., '11' are checked/colored)?
Thank you!
You can use this formula on cell B2 of your main sheet (assume Sheet1 is your survey sheet and Sheet2 is your main sheet):
=IF(iferror(match(CELL("address",B2),ARRAYFORMULA(ADDRESS(ROW(B2),1+split(Sheet1!$B2,","))),0),0),TRUE,FALSE)
Then drag right and down to the end of the table.
Sample:
Explanation:
SPLIT creates an array of numbers based on your input delimited by commas.
ADDRESS creates a string of cell references. ARRAYFORMULA extends this to an array.
MATCH returns a valid value if the CELL reference of the cell position exists on the other table, else it will return error.
IF and IFERROR will return true or false depending on the value of MATCH.
use:
=ARRAYFORMULA(REGEXMATCH(COLUMN(B:K)-1&"",
"^"&SUBSTITUTE(SUBSTITUTE(IFNA(VLOOKUP(A10:A12, A1:B3, 2, 0)), " ", ), ",", "$|^")&"$"))

Google sheets, how to create a table of Vlookup and get the last occurrence for each customer

I have a database of customers, where his zone, seller and some other values can change, and I want to generate a table of the last occurrence of each one
Heres a demo sheet
using Vlookup doesn't get the last occurrence
My database is very big and I need something to not slow my sheet that much, because I was using a formula like this one for each cell
=ARRAYFORMULA(LOOKUP(2,1/(C2:C=A2),$D$2:$D))
but the sheet is very slow because of this
Any help on this please ?
use:
=ARRAY_CONSTRAIN(SORTN(SORT({C3:E, B3:B}, 4, 0), 9^9, 2, 1, 1), 9^9, 3)

Filter column with condition Google Sheets

I'm using Filter function using Google Sheets but can't use it the way I want, it has been 3 days...
Basically I have Sheet 1 with a column "e-mail" and column "Lead ID". The Sheet 2 has the same "Lead ID", but it's filtered. Meaning, Sheet 1 it' sequential with 1,2,3,4,5...and sheet 2 it's not, it's like 2,4,5,23,41... What I want to to find the right e-mail address that's in Sheet 1, that has the same Lead ID in both. I've used Filter function which works really well because it updated the rows and I dont need to drag the cell. But in this case this is not working:
ABD!C:C it's the E-mail Column.
ABD!T:T it's the Lead ID Column Sheet 1
A:A It's Lead ID Column Sheet 2.
=FILTER(ABD!C:C,ABD!T:T=A:A)
It returns the name of the column (e-mail) and not the actual e-mail address. If I use A2 instead of the column A:A, it works. But I can't use that way because I need to drag that cell and that causes a problem. I need to use this as the filter works which doesn't require to drag the cell.
=FILTER(ABD!C:C,ABD!T:T=A2)
https://docs.google.com/spreadsheets/d/1MKXCAc1-d8OU008OEHI2Tu7AObvaOueUD30jl5iG6W8/edit?usp=sharing
Any advice?
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, {ABD!T:T, ABD!B:B}, 2, 0)))

Resources