I have a spreadsheet 'Database' where there are two columns, 'Countries' (A) and 'Companies'(B). Countries are numbered from 1-10. Companies are labelled with letters.
The spreadsheet tracks the companies that operate in each country. As such, a row that has Country 1 in column A and Company A in column B means that Company A operates in country 1. This is a screenshot from this spreadsheet:
I then have a second spreadsheet called 'Countries by Company' where I would like to list the countries in which a company operates. I would like them to be listed in different rows starting form cell B3 of the 'Countries by Company' sheet. The company name for which the countries should be listed is in cell B1 of the same sheet. I gather this has to be done with an ARRAY version of an INDEX MATCH function but I can't seem to get it to work.
I have put the following formula in cell B3 of the 'Countries by Company' sheet: =INDEX(Database!$A$1:$B$76, MATCH($B$1, Database!$B$1:$B$76, 0), COLUMN(Database!A:A)). However, as expected, it will only return the first country in which the company in cell B1 operates and no other country. Again, I would need all countries in which that company operates listed in different rows from cell B3.
I have set up a sample sheet in here. I thought it might help in case I wasn't too clear.
Thanks for your help!
Using FILTER allows restricting the values on the Database sheet to only those that match a given criteria:
=FILTER(Database!$A:$A, Database!$B:$B=$B$1)
yields every country index for the given company index on the Database sheet. If only the country index values (e.g. 1, 3, 6) are desired, rather than converting those index values to a name or other property that is held in a hypothetical "Country DB" sheet, the above FILTER is sufficient.
If additional information is desired, then VLOOKUP can be used to return the corresponding values for multiple inputs (i.e. an array input):
B3: =ARRAYFORMULA(VLOOKUP(
FILTER('Database'!$A:$A, 'Database'!$B:$B=$B$1), // Searched values
'Country DB'!$A:$B, // Database sheet having more country information (like name, gdp, ...)
2, // Column of the desired information
FALSE))
will yield the 2nd column from each corresponding country index row in the "Country DB" sheet:
Try using Filter
=filter(Database!A2:B,Database!A2:A=B1)
Related
I need to sum-up values from another sheet in Google sheets. Column name is called Rating in sheet two named Results!
Tried this, however for some of the rows when I drag the formula down it produces errors, even though the data is identical.
Is there a way I could also link the name in the formula, name look-up value is in sheet1 called Calculator, in row A4 in sheet two it's the name is found in row A2, name format Alise Ryan.
=Results!K2+Results!P2+Results!U2+Results!U2+Results!AE2++Results!AJ2++Results!AO2+Results!AW2++Results!BA2++Results!BF2++Results!BK2++Results!BP2++Results!BU2++Results!BZ2++Results!BZ2
try:
=INDEX(IF(Survey!A2:A1000="",,{Survey!A2:A1000,
MMULT(FILTER(Survey!A2:1000, Survey!A1:1="Rating")*1,
SEQUENCE(COUNTIF(Survey!A1:1, "Rating"), 1, 1, 0))}))
In my example:
https://docs.google.com/spreadsheets/d/1QQNTw_r9-q-FqVNwUoYklup73niZCFyO0VDUYImP5fo/edit?usp=sharing
I'm using Google Forms as an eBay clone to sell rare items. Each bid is outputted from the form to the "Data" worksheet and then I have ArrayFormulas set up inside the "Processed" worksheet. The idea is that I want to process the bids so that we filter everything except the items with the highest bids. All data should be automatically updated, hence why I want to use ArrayFormulas.
My strategy is that in colum A, I first filter all unique items (=unique(filter(Data!A2:A,Data!A2:A<>""))) and end up with:
Jurassic Park 6-Pog Hologram Set
Princess the Bear TY Beanie Baby
Holographic 1st Ed Charizard
However, then in column B, we have to find the highest bid that corresponds to that unique item, e.g.:
=IF(ISBLANK(A2),,ArrayFormula(MAX(IF(Data!A2:A=A2,Data!B2:B))))
However, I don't want to have A2 be a single cell (A2) but an array (A2:A) so that it doesn't have to be manually copied down the rows. Similarly, I also want columns D and E to be automatic as well. Is there any way to achieve this?
Not sure if it would be considered easier than the previously posted answer, but in case this thread is found in the future, I think that this is a slightly simpler way to solve these kinds of problems:
Try this on a fresh tab in cell A1:
=FILTER(Data!A:D,COUNTIFS(Data!A:A,Data!A:A,Data!B:B,">"&Data!B:B)=0)
I did some research and found an answer very similar to what you were looking for. After rearranging the formula slightly to match your sheet, I was able to get this to work:
=ArrayFormula(vlookup(query({row(Data!A2:A),sort(Data!A2:C)},"select max(Col1) where Col2 <> '' group by Col2 label max(Col1)''",0),{row(Data!A2:A),sort(Data!A2:D)},{2,3,4,5},0))
This formula automatically populates product name, highest bid, username, and timestamp. I ran some tests, adding my own random names and values into the data sheet, and the formula worked great.
Reference: https://webapps.stackexchange.com/a/75637
use:
={A1:D1; SORTN(SORT(A2:D, 1, , 2, ), 9^9, 2, 1, )}
translated:
{A1:D1} - headers
SORT(A2:D, 1, , 2, ) - sort 1st column then 2nd column descending
9^9 - output all possible rows
2 - use 2nd mode of sortn which will group selected column
1 - selected column to be marged based on unique values
I would like to retrieve average daily milk from sheet 1 to sheet 2. Each row has a unique identification number. The average daily milk data exported to sheet 2 is linked to the unique ID Nr. In sheet 1 there are many more unique ID.Nr ( Rows) present than in sheet 2. How do I transfer the data from sheet 1 to sheet 2 in exact correlation to identification nr, without sorting the rows?
I have tried vlookup function but result is always NA. I belive it should be an array function, as it has too look for ID Nr. and cannot use position of cell.
Table Sheet1 is on a different Worksheet than Sheet 2 but on same File.
Vlookup should work just fine. The only thing is that you have to make sure that the Id Nr. in both sheets are the same type (In this case both should be strings since they have "_" in the text). This is how you should use the vlookup:
=VLOOKUP(A2,Sheet1!A:B,2,FALSE)
And then copy the formula all the way down in column B of sheet2
The solution is to use the index match function. The advantage in comparison to an lookup function is that it handles great amount of data better and also the reference number does not need to be on the far left column.
I have a list of columns in a Google Sheet.
(ID, name, title, company name) and then I have a domain column though the data in that column doesn't line up with the other respective columns. For example for the first row the domain should be pgconsulting.net not nixon.com as shown below. And so forth.
ID, Name, title, company, domain
02, Eric Mensin, CEO, PG Consulting,
Nixon.com
03, Nick Doe, Director, Nixon,
pgconsulting.net
04, Erin Mathews, Manager, Streetz,
poolcues.io
Is there anyway to ensure that the correct domain appears next to it's respective Company name (and the thereby correctly match the rest of the columns).
Thanks and your help is much appreciated!
Here is the function I discovered to make it work.
IF value exists in one cell match value based on another cell next to it.
=IF(ISERROR(MATCH(G2,J:J, 0)), "No Match", VLOOKUP(G2,J:K,2,FALSE))
In the above example, the G column contains the correctly ordered company names and the function is taking the value in G2 (in this case a company name) and trying to find it in the J column.
If not found the cell will display the "No Match". However, if found it will take the value located next to the J column (in this case domains are located in column K).
If you have two columns of domains and you want to choose the best one based on filters (in this case if the column contains facebook, or linkedin)
=SWITCH(L2,"linkedin.com",H2,"",L2,"facebook.com",H2,"")
And then if you want to combine best domain chosen, you can use the following code:
=IF(LEN(M2),M2,L2)
I currently have the following formula, where the intention is to search one sheet for names, then pull the job title from another sheet with the same layout. However, it keeps only returning job titles from C column, and I to some extent know why, but I have no idea how to get the index, and in turn cell address call, to return matches with the correct column value.
Essentially the ActualVolunteerSchedule sheet has names, the TaskingSchedule has jobs in the time slots.
In EmailPrep sheet I am combining the time marker from column A with the job title from inside the table based on finding a matching name from row 1 in the email prep sheet.
So given a range say B:H on sheet1 - find all cells containing NAME, then grab cell contents from sheet2 with the same address. NAME found at sheet1!$C$3 then return value of sheet2!$C$3
INDIRECT("TaskingSchedule"&"!"&RIGHT(CELL("address",INDEX(ActualVolunteerSchedule!$C$1:$H$74,
SMALL(IF(ActualVolunteerSchedule!$C$1:$H$74=B$1,ROW(ActualVolunteerSchedule!$C$1:$H$74)),ROWS(A$3:A3)))),4))
Actual File
Google Sheet