How to select the correct range in Google Sheets - google-sheets

I have data in Google Sheets and I'm trying to run a pivot table. The problem is that the title is on cell a1 but data doesn't start until a60. I don't want to include the data in cells a2 through a59. If I run the pivot on a60 to a102 then it thinks a60 is the title and doesn't include it. How do I tell sheets to use a1+a60-a102?

if this would not be a pivot table you would need to do this:
={a1; a60:A102}
the best workaround you can ever have is to paste this on some new sheet (which you can hide) and then build your pivot table from there

Related

Google Sheets Query Search Box | Search criteria

so basically I have a searchbox in my sheet that searches and pulls up data. For a reference see this image: https://i.imgur.com/MVTUCSw.png. So basically in cell A4 I put the data that I am looking for, but my formula restricts me to only looking up stuff in 1 row. For example, data starting with the word MELD, but I would like to be able to also look up data based on for example the someone their name.
The formula I use for the searchbox: =QUERY({'Pallets & Locaties'!A2:G;Voorraadverschillen!A2:G}, "SELECT * WHERE Col1 "&Opzoeken!B4&" '"&A4&"'")
The data that I want to be able to look up is stored in 2 sheets: Pallets & Locaties - https://i.imgur.com/qV7h2tz.png and in Voorraadverschillen - https://i.imgur.com/foqLkKa.png.
The searchbox is only able to lookup data in row, but I just want to be able to search for any kind of stored data in any of the sheets.
Here is my sheet for reference: https://docs.google.com/spreadsheets/d/10wmnxV16JUiD_b_54abkiLPwTqLITWRcUw3gsqvXoBE/edit?usp=sharing
I'd recommend you add more rows for the lookup criteria and add a column for what column it would search for.
Sheet modification:
Formula:
=QUERY({'Pallets & Locaties'!A2:G;Voorraadverschillen!A2:G}, "SELECT * WHERE "&TEXTJOIN(" AND ", TRUE, ARRAYFORMULA(IF(ISBLANK(A4:A10), "", A4:A10&" "&B4:B10&" '"&C4:C10&"'"))))
Test Sheet
Note:
The above formula will allow you to search on other columns with their own words and criteria to search.
Only rows with Kolom values will be included in the criteria. If you only need Col1 criteria, make sure to leave other rows blank.
This does use an AND search, meaning all of the criteria should be true and match the row. Feel free to use OR in the TEXTJOIN function if you only want to search all rows matching any of the criteria.
This will only search on sheets Pallets & Locaties and Voorraadverschillen. Add the necessary sheets if you need them.
EDIT:
Cleaned up the formula to not be so repetitive.
=IF(A4<>"",(QUERY({'Pallets & Locaties'!A2:G;Voorraadverschillen!A2:G},"Select * WHERE "&textjoin(" OR ", true, arrayformula("Col"&ROW(1:7)&" "&B4&" '"&A4&"'")))),(QUERY({'Pallets & Locaties'!A2:G;Voorraadverschillen!A2:G},"Select * WHERE Col1 IS NOT NULL")))
This searches every column for the data, as long as data is not identical in two columns you won't have issues. An example would be the search criteria "MELD" being in both Column A and B. If that were the case, only the results from the first matching column would populate.

Google Sheets filter command with search function

I am trying to create a search function across multiple sheets and using the filter command has been the best method so far but wanted to know if you could display all information across the sheets for one individual.
The current filter code that displays all information from the 2 sheets:
={filter(Sheet1!A2:C10, len(Sheet1!A2:A10)); filter(Sheet2!A2:C3, len(Sheet2!A2:A3))}
I am using cell B2 as the search box. A name will be entered into cell B2 that the user wants to search for. Can cell B2 be added into the code above so it displays all information only about the one name?
Try with query
=query({Sheet1!A2:C;Sheet2!A2:C},"select * where Col1 = '"&B2&"' ")

How to connect two google sheet workbooks using SUMIFS?

I have the following formula
SUMIFS(Sheet1!I2:I12,Sheet1!H2:H12,"1111-1111",Sheet1!B2:B12,"1111")
I want the Sheet1 from a separate workbook (not sheets in the same workbook), how can I do this?
My workbook1 is https://docs.google.com/spreadsheets/d/1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0/edit?usp=sharing
I want to do following in workbook2
= SUMIFS(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag","Sheet1!I2:I12"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag", "Sheet1!H2:H12"),"1111-1111",IMPORTRANGE("https://docs.google.com/spreadsheets/d/1VayuaMlSMvkhBKKuQnRTuTwk6kshFWQanWxa5KWh2ag", "Sheet1!B2:B12"),"1111")
use:
=QUERY(IMPORTRANGE("1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0", "Sheet1!A:I"),
"select sum(Col9)
where Col8 = '1111-1111'
and Col2 = 1111
label sum(Col9)''")
You can use the IMPORTRANGE formula to pull data from another sheet.
You can either embed the IMPORTRANGE in your formula in order to pull directly from it, or you can use the formula on its own in a new sheet, and pull from the sheet located within the same Spreadsheet for ease of access and a shorter formula overall.
Updating the spreadsheet you are pulling from will automatically update the data coming from the IMPORTRANGE formula.
For example:
A1 contains the basic formula =importrange("https://docs.google.com/spreadsheets/d/1I8BiB-2gSFueLIKiGsMY-URLOpnB8QzbUrx8/edit#gid=0", "Sheet1!I1:I12")
while B1 contains =sum(importrange("https://docs.google.com/spreadsheets/d/1I8BiB-2gSFueLIKiGsMY-URLOpnB8QzbUrx8/edit#gid=0", "Sheet1!I1:I12"))
Make sure you replace the URLs above with the one for the sheet you are trying to pull from
I think you need to use IMPORTRANGE to bring in the columns you want to your active sheet. You can either import the data first and then use a formula in another cell to work with it, or you can use IMPORTRANGE inside your SUMIF formula.
EDIT: Here's a workbook that has it working.
The formula in Sheet1!A1 is =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1L4t2xkmHPAOn8uGT3bFy56UMWrZaHsyq4FlOh6uR2g0/edit?usp=sharing","Sheet1!A1:I12"), which pulls the data from your shared workbook1 into this sheet.
The formula in Sheet2!A2 is =SUMIFS(Sheet1!I2:I12,Sheet1!H2:H12,"1111-1111",Sheet1!B2:B12,"1111")
You could also put the SUMIFS formula on Sheet1 if you prefer. It's 2 steps instead of one, but it works!

How to make a dynamic import command from one sheet to another in google sheets

I want to build a tool that lets me insert a spreadsheet in a given format into sheet1. Then it takes some data and inserts it into a specified location in sheet2.
I am using functions in the following format at the moments:
=Sheet1!AI2
For every column, I need the data from all rows i.e sheet1 A1 to sheet2 B2, Sheets A2 to sheet B3 ...
There are hundreds of rows and I don't want to copy-paste it and manually change the row number.
Is there a way to do it like this:
=Sheet1!AI(rownumber-1)
That way it would work for all rows.
Thanks for taking the time and reading this!
Try putting this in Sheet2!B2
=ARRAYFORMULA(Sheet1!AI:AI)
or this (it will give you the same result):
=INDEX(Sheet1!AI:AI)
Be sure that Sheet2 has at leas one more row than Sheet1. Google Sheets will automatically add 500 new rows, but if the numbers of rows in those sheets are codependent than rows will be added in a loop up until the limit.

Add column with cell values to tables merged using Query

I use this Query formula in Google Spreadsheet to merge tables from many source sheets into one table:
=query({Data1!A4:B;Data2!A4:B;Data3!A4:B}; "select * where Col1 is not null")
To distinguish original tables in the merged table, I need to add new column to the merged table with their identification. The indentification string is in cells on every source sheet. How to do it?
This is example spreadsheet I prepared for tests. Copy it to your Google Drive to make changes please.
https://docs.google.com/spreadsheets/d/1YimEsiDa3gTiKqv7DMohfNvBDruvQ13zrK23Y3R3Gsw/edit?usp=sharing
I suspect the simplest way is the "long-winded" add a column in each sheet (say a new "A") and populate that with the sheet name, so then a query like so:
=query({Data1!A4:C;Data2!A4:C;Data3!A4:C}; "select * where Col2 is not null")
Edit re Comment:
Not the layout required but at least differentiates the source without adding anything to the sources:
={query(Data1!A4:B,"select * where A is not NULL label A '"&Data1!B1&"'");query(Data2!A4:B,"select * where A is not NULL label A '"&Data2!B1&"'");query(Data3!A4:B,"where A is not NULL label A '"&Data3!B1&"'")}

Resources