I would like to access data from one Google Spreadsheet on another using strictly formulas.
Currently, I am able to import data using the =IMPORTRANGE(), but need to take this a couple steps further.
The data that I have looks like this:
Spreadsheet 1: Each sheet is for a different day, and has people and the number of fruits they pick from a farm (this is example data). However, the people are not necessarily organized exactly the same way on each day.
Spreadsheet 2: Each sheet is organized by person. Row A has the day (which will be used to lookup from the other spreadsheet), and a function exists in the second spreadsheet to find the persons name (=sheetName()).
What I have so far is [for Spreadsheet 2]:
=IMPORTRANGE(Master!A1, A2 & "!B2")
Where Master!A1 refers to the link of the other spreadsheet, A2 refers to the Day1. However, the part I am looking to replace is the 2 in the B2 to find the row of the person's name in the sheet Day1 from the first spreadsheet.
I feel like I have to do something like this:
=IMPORTRANGE(Master!A1, A2 & "!B" & MATCH(IMPORTRANGE(Master!A1,A2 & "!B1:B100"),sheetName(),0))
, but this gives me the error that it "Did not find value 'Apples' in match evaluation"
Here is the example folder with the two spreadsheets.
https://drive.google.com/drive/folders/0B8lJN2vmKeTBV1JYR2ZoZlVfQUU
All help is appreciated!
I can't find the sample data that you attached but here's what you need to do.
1. Link of the other spreadsheet
2. Name of the sheet to import from
3. =importrange(link,sheet!A:D) [for the sake of an example]
4. =query(importrange(link, sheet!A:D),"select * where Col1 = 'Person's_Name' ",1)
Share a sheet if you are not able to put it together on your data. Cheers!!
Related
There are many similar questions on here but I can not find the answer I am after.
I am working in Google Sheets and need to write a conditional formatting equation that will highlight the B:C columns if they match an entry on the second sheet in the B:C columns. I do not know any search criteria past that which is where I keep running into an error. All the other questions here know what they are searching for. My work is fluid and new entries come in that may match an old one and I need to know that!
I use this formula on the first sheet to match entries specifically on the first sheet,
=COUNTIF(ARRAYFORMULA($B$3:$B$389&$C$3:$C$389),$B2&$C2)>1
This formula works great. If Lexington, SC is in row 2 and Lexington, SC is added again later in row 100, BAM they both light up red. Love that. The second equation I need is not so simple.
my data is:
SHEET 1 - Column B and Column C
County
State
Lexington
SC
Douglas
KS
Chase
KS
Clay
OH
Greenwood
NY
SHEET 2 - Column B and Column C
County
State
Saratoga
NY
Douglas
KS
Chase
KS
Clay
OH
Greenwood
SC
In this example above, I need the new formula to highlight Douglas KS, Chase KS, Clay OH on sheet one, because these three counties exists on Sheet Two.
I have tried MATCH, INDEX, VLOOKUP, etc. I keep running into an issue when I want TWO columns to be compared to TWO columns. It needs to be county name AND state.
Thank you to the community for any help you can give. I will provide more information if it is needed! I think this sums up my issue though.
QUERY ATTEMPTS
=COUNTIF(ARRAYFORMULA($B$2:$B$20&$C$2:$C$20),$B2&$C2)>1
=COUNTIF(ARRAYFORMULA('Sheet 2'!$B$2:$B$20&$C$2:$C$20),$B2&$C2)>1
=COUNTIF(ARRAYFORMULA(indirect("Sheet1!$B$2:$B$C$2:$C"),indirect("Sheet2!$B2:$B&$C2:$C")))>1
=ARRAYFORMULA(IFERROR(VLOOKUP(B2:C,"Sheet 2!$B2:$C",2, FALSE),""))
=ARRAYFORMULA(INDEX(B2:B19, MATCH(1, FIND(E2, C2:C19)), 0))
=ARRAYFORMULA(INDEX(B2:C,MATCH(indirect("Sheet 2!$B2:$C"),0)))
=MATCH($B2&$C2,indirect('Sheet 2'!$B2:$B&'Sheet 2'!$C2:$C"),0)
=MATCH($B2,indirect("Sheet 2!$B2:$C"),0)
=MATCH("Sheet 1!$B2&$C2",indirect("Sheet 2!$B2:$C"),0)
=MATCH("Sheet 1!$B:$C"),indirect("Sheet 2!$B:$C"),0)
=MATCH((B2&C2),indirect("Sheet 2!(B2&C2)"),0)
=INDEX($B2:$C2,MATCH($B2&$C2,indirect("Sheet 2!$B2:$C"),0)
=INDEX(B:C,MATCH($B2&$C2,indirect("Sheet 2!$B2:$C"),0)
=INDEX(B2:C710,MATCH(0,(B:C="Sheet 2!$B:$C"),0))
The only query I have gotten to work only works on the B column
=match($B2,indirect("Ready to Start!$B2:$B"),0)
in conditional formatting (and data validation) whenever you want to refer to another sheet, that sheet's range needs to be INDIRECTed. if you got a joint range (like you do) both of them need to be wrapped in INDIRECT
try:
=COUNTIF(ARRAYFORMULA($B$3:$B$389&$C$3:$C$389),
INDIRECT("Sheet 2!B2")&INDIRECT("Sheet 2!C2"))>1
or:
=COUNTIF(ARRAYFORMULA(INDIRECT("Sheet 2!B3:B389")&INDIRECT("Sheet 2!C3:C389")),
$B2&$C2)>1
but note that this will work only if let's say B4&C4 on BOTH sheets are the same.
if one sheet compared to other has different sorting of the same values you will need a completely different formula...
if your sheets are named exactly:
Sheet 1
Sheet 2
try this in Sheet 1:
=($A2<>"")*REGEXMATCH($A2&$B2, TEXTJOIN("|", 1,
INDIRECT("Sheet 2!A2:A")&INDIRECT("Sheet 2!B2:B")))
I have two external GSheets that are set up as room bookings with a running date in col B and the different rooms ppl can book in col C-AX for Sheet1, C-X for Sheet2, as well as my own Sheet with a list of names (let's call it NameSheet).
Example:
Goal: I want to add an extra column in NameSheet that returns all dates within the next two weeks in which a person has booked a room as well as the room info. Like this:
I used IMPORTRANGE to import both Sheets into my own Sheet (Merged_Sheet) and then merge them dynamically using a simple query formula:
=QUERY({'Sheet1'!A:AX;'Sheet2'!A:AX},"select * where Col1 <>''")
(I had to expand Sheet 2 to AX in order to merge them.)
I then set up another sheet (Date_Filter) to dynamically filter on the next two weeks:
=filter('Merged_Sheet'!A:AX,'Merged_Sheet'!B:B<=today()+7*1)
Finally, I have so far only managed to add a column in my original NameSheet that counts the number of times a there is a partial match on a name in the Merged_Sheet:
=countif(Date_Filter!A:AX,"*"&Name&"*")
Now I'm stuck on how I can return the dates & room info on a partial match (the name columns in the room sheet are "[First Name] [Last Name]" while the employee sheet is set up as "[Last Name],[First Name]") across an entire sheet. I've tried using regexmatch, filter, contains, and even the query function again, but I keep getting function errors.
I would super appreciate any formula help. :)
I am needing to combine all student attendance in one chart. I have tried Query, Vlookup, and Index Match - nothing seems to get the results I want. I need something to search first and last name and return all attendance from all sheets. I would like to use something like CHOOSE and INDIRECT due to the future size of this sheet.
Here is what I have tried:
=ArrayFormula(VLOOKUP(K2&L2,CHOOSE({1,2},{Indirect(E2) & INDIRECT(F2), Indirect(D2)},{1,2})))
=query(Arrayformula({INDIRECT(D2), Vlookup($K$2:$K$45 & $L$2:$L$45, {Indirect(E2) & INDIRECT(F2), Indirect(D2)}, false)}),"select Col1,Col2,Col3,Col10,Col17,Col24,Col31 where not Col1 is null",1
=ArrayFormula((VLOOKUP(K2,INDIRECT($D$3),{1,2,3,10,17,24,31})))
This is a very small example of what the final sheet will be. I included what I want the results to be on a separate tab.
https://docs.google.com/spreadsheets/d/1-XNePmTzVIc84ScasZxh1KlzTBxDyI_glxwg24uXGuI/edit#gid=868379110
I have 2 google workbooks. One is a rate sheet and the other is a vendor list with pricing.
I have the vendor list with pricing workbook linked to the rate sheet workbook via importrage command. This works great and everything updates as it should until you add a new line or remove a line to the rate sheet workbook. At this point the vendor workbook does not update the reference and just still points at the same lines it was originally, now displaying the incorrect data.
How can I dynamically have the vendor list workbook notice the addition or removal of lines in the rate sheet workbook and update the importrange formula?
Can this be done?
Any help is greatly appreciated.
EDIT: I have prepared 2 sample workbooks. They are Test sheet 1 - Rates and Test Sheet 2 Lanes
I have all of our rates in the first sheet. In the second we would have vendor lanes. This sheet consists of multie tabs all with an individual lane that is linked to 1 row in the rates sheet.
In the lanes sheet I have linked the two together via importrange in cell A8. Now this works and links properly, that is until you insert a new line in the rates sheet above the one the lane is linked to and then it doesn't update but shows what the new line information is.
Is there a way to have the lanes sheet dynamically update to the next line when a new line is inserted in the rates sheet?
two sheets links are as follows:
Rates
Lanes
Solution 1 - if you need to check only one condition
To achieve desired result you have to have something like an ID for every rate. For sake of this answer (based on your example sheets) I assume that this could be an Origin City. In Test Sheet 2 I have added new sheet - SheetTest where:
First step
I am looking for the row number where desire City reside in Rates sheet (in example - its Mcclellan city). The code for that is simple:
MATCH(A2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1JD45y-0-37Kh2KsHnRAMuB0quPtMVuLKuT1qjnNcm1Q/edit","Rates!B:B"),0).
This gives me -> 10
Second step
I use this result to dynamically generate final range - "Rates!A10:X10". The final result in A8 cell is (to make it clearer, I change an address of a sheet to -othersheeturl- :
=IMPORTRANGE(
"-othersheeturl-",
"Rates!A"&
MATCH(A2,IMPORTRANGE(-othersheeturl-","Rates!B:B"),0)
&":X"&
MATCH(A2,IMPORTRANGE("-othersheeturl-","Rates!B:B"),0)
)
Working example
Warning
I see that in your original sheet you use "take" Origin City from Rates sheet, so I remove this dependency in A2 to make it an ID. I hope this solves your problem.
Solution 2 - if you need to check many conditions
An approach is the same, but tools are different. Main goal is to find a row number that meets criteria - "From City" and "To City". Then this row number will be used to concatenate desire range.
First step - some cleaning
To better manage complex formulas its a good idea to divide them into smaller pieces - like in "ordinary" programing. So, we have:
From City in A5
New Albany
To City in B5
Calgary
Rate sheet (external sheet) url in B1:
1JD45y-0-37Kh2KsHnRAMuB0quPtMVuLKuT1qjnNcm1Q
You don't have to put whole URL, only this part is needed
Formula that counts row number that we are looking for in B2
=QUERY(
{IMPORTRANGE(B1,"A1:B"),
ArrayFormula(row(INDIRECT("A1:A"&ROWS(IMPORTRANGE(B1,"A1:B")))))},
"select Col3 where Col1='"&B5&"' and Col2='"&A5&"'
limit 1")
Above code:
Build an array from Rate sheet (external) - columns A1:B and virtual index that represents rows numbers
Then, show only column nr 3 (index) where Col1 matches our "To City" and Col2 matches "From City"
At the end is a limit to only one result (in case that there are more then one maches)
Desire range in B3
="Rates!A"&B2&":X"&B2
Final formula that renders desire data from external sheet in A11
=IMPORTRANGE(B1,B3)
Working example
Final thoughts
You can either hide rows 1-3 or you can pack all above formulas into one. Its up to you. I prefer the first approach.
This solution gives you freedom with as many conditions as you want
More info would be helpful.
A couple ideas:
Using named ranges instead of a static reference. For example, if you create a named range in the rate sheet called MY_DATA that references A2!C600, you can include "MY_DATA" in your importrange in the vendor sheet. Note that you'd still need to update MY_DATA every time you add a row.
If you're importing the entire sheet, perhaps omitting the end row would work (e.g. A2!C instead of A2!C600) - note that this means you need to use filter or query in the Vendor sheet to eliminate the blank rows.
I have been working on how I budget and keep track of my finances. In the process, I put together this Google Sheet which I am happy to share a dummy version of (includes dummy data).
I use a Google Form to input new entries which are recorded in the 'Log' page.
From here, I use a few SUMIFS to pull in the totals of any given income/expense category based on the category name (referenced in the cell adjacent), the month (B3), and the year (C3).
What I now want to do is add a table (currently in columns O:Q) that calls in itemised log records based on the category selected (O2) and the month and the year. On the reference sheet these are cells (B3) and (C3) respectively and in the log, these are columns (F) and (G).
I've gotten as far as using an INDEX / SMALL array formula combination to pull in all spending as per the category selected in (O2), but what I cannot seem to figure out is how to then restrict results to only those that also match the month and year. I've tried using a MATCH formula but am unsure how to append this within the current formula string, if it is even possible?
Once working, this would (for example) mean that only rows 4 and 5 in columns O, P, and Q would be populated as these are the records for the selected month, June 2016.
Is what I want to do possible through a more complex formula? Can anybody help?
Thank you in advance.
Link to my Google Sheet: https://docs.google.com/spreadsheets/d/1_GGgFCfMtB5ROkTmpx4Fn4nZZbBIvBa4vpOwqswH5E0/edit?usp=sharing
The following should do the trick.
Delete everything in O4:Q14
In cell O4, write: =FILTER(Log!H2:H, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell P4, write: =FILTER(Log!E2:E, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
In cell Q4, write: =FILTER(Log!D2:D, Log!B2:B=O$2, Log!G2:G=C$3, Log!F2:F=B$3)
(By the way, you can generate columns F, G and maybe E from column A in the Logs sheet. For example, just remove the data that is already in column G and in G2 write: =ARRAYFORMULA(YEAR(A2:A))
Link to spreadsheet with fixes:
https://docs.google.com/spreadsheets/d/1iIplXRa28L7FdmqI91RbjApO3g-GU5uk6rTQLqi7vFw/edit#gid=0