I have two sheets.
Sheet1
Name
Price
Boots
30
Dress
10
Jeans
25
Shirt
15
Sneakers
35
Sheet2
Name
Dress/Red
Jeans/Blue
Dress/Black
Shirt/White
Dress/White
I want to collect data to Sheet3 using one formula (unique names that contained in Sheet2):
Sheet3
Name
Price
Dress
10
Jeans
25
Shirt
15
I've tried to make some queries but I don't have enough knowledge. Could you help me please?
try:
=FILTER(A1:B, COUNTIFS(INDEX(SPLIT(D1:D, "/"),,1), A1:A))
Related
-I'm trying to create a google sheet that tracks progress of players in a team.
-Each season has its own tab.
-A tab that combines data from all sheets is needed.
-The players in the seasonal tabs are going to be in different order each season based on their performance, there are also going to be players coming and going so I can't know which row is going to include which player's data.
-The combined table needs to be able to refer to rows in other tabs where the player name is present, and count up total points for them.
Picture 1 is individual season table. Picture 2 is where I was stuck. Picture 3 is the desired output, which was achieved using the answer provided.
Example of desired output:
Player
Season 17
Season 18
Total
Player1
1800
880
1680
Player4
100
100
200
Player12
50
21
71
Player2
33
11
44
Player3
2
5
7
Player33
1
2
3
You can merge all the data in a new sheet by using the following formula:
={FILTER(Sheet1!$B$3:$P, len(Sheet1!$B$3:$P)),
FILTER(Sheet2!$B$3:$P, len(Sheet1!$B$3:$P)),
FILTER(SheetN!$B$3:$P, len(Sheet1!$B$3:$P))}`
You have to repeat the FILTER(...) part for each sheet.
In the new sheet, get the list of unique user names with =UNIQUE($A:$A), where A is the column with the player names. You can also use a list you already have instead.
You can then use =SUMIF($A:$A;P1;$B:$B) to compute the grand total for each player, where A is the column containing all the names, B the column containing all the total scores, and P the column containing the UNIQUE player names.
Alternatively, you can use =VLOOKUP(P1, SheetN!$B$3:$N$100, 13, FALSE) in the new sheet to read the total score of the player with the name in the cell P1.
I think that with more advanced magic you may be able to automatically gather the data from all the sheets, but in this case you have to manually type each heet name.
I was recently tasked with 'exploding' each row in a given range with respect to the split value of one of the columns, i.e. going from
Name
Interests
Age
John
swimming, movies
31
Mary
basketball
26
Richard
football, music
21
to:
Name
Interest
Age
John
swimming
31
John
movies
31
Mary
basketball
26
Richard
football
21
Richard
music
21
It's a little similar to a Cartesian product, only one of the terms needs to be computed on the basis of the value in the Interests column. I eventually solved it using an Apps Script function, but I'm wondering if it could be easily solved using a regular formula.
Note that the input range in my case was a product of another formula (a QUERY(...), to be exact), so not necessarily contiguous or addressable within the spreadsheet.
Any ideas?
try:
=INDEX(QUERY(SPLIT(FLATTEN(A1:A&"×"&SPLIT(B1:B, ", ", )&"×"&C1:C), "×"),
"where Col3 is not null"))
You can use the custom "UNPIVOT" function found on this sheet. File>Make a Copy to grab the script. Also here on github.
=ARRAYFORMULA(UNPIVOT(A2:A,"V",SPLIT(B2:B,", ",0),"B",C2:C,"V"))
You would then QUERY() the output to eliminate the rows where there was nothing in the second column.
It's not hard to do this with custom function, but I'm wondering if there is a way to do it using a formula. Because datas won't automatically update when using custom function.
So I have a course list sheet, each with a price. And I'm using google form to let users choose what courses they will take. Users are allowed to take multiple courses, so how many they will take is unknown.
Now in the response sheet, I have datas like
Order ID
User ID
Courses
Total
1001
38
courseA, courseC
What formula to put here?
1002
44
courseB, courseC, courseD
What formula to put here?
1003
55
courseE
What formula to put here?
and the course sheet is like
course
Price
A
23
B
33
C
44
D
23
E
55
I want to output the total for each order and am looking at using FILTER to do this. Firstly I can get a range of unknown length for the chosen courses
=SPLIT(courses, ",") // having named the Courses column as "courses"
Now I need to filter this range against the course sheet? not quite sure how to do it or even if it is possible. Any hint is appreicated.
try:
=ARRAYFORMULA(IF(A2:A="",,MMULT(IFERROR(
VLOOKUP(SPLIT(C2:C, ", "), {F1&F2:F, G2:G}, 2, 0))*1,
ROW(INDIRECT("1:"&COLUMNS(SPLIT(C2:C, ", "))))^0)))
demo spreadsheet
As I need time to digest #player0's answer, I am doing this in a more intuitive way.
I create 2 sheets to store intermediate values.
The first one is named "chosen_courses"
Order ID
User ID
1001
=IFERROR(ARRAYFORMULA(TRIM(SPLIT(index(courses,Row(),1),","))),"")
1002
=IFERROR(ARRAYFORMULA(TRIM(SPLIT(index(courses,Row(),1),","))),"")
1003
=IFERROR(ARRAYFORMULA(TRIM(SPLIT(index(courses,Row(),1),","))),"")
In this sheet every row is a horizontal list of the chosen courses, and I created another sheet
total
course price
=IF(isblank(order_id),"",SUM(B2:2))
=IFERROR(VLOOKUP('chosen_courses'!B2,{course_Names,course_price},2,false),"")
=IF(isblank(order_id),"",SUM(C2:2))
=IFERROR(VLOOKUP('chosen_courses'!B2,{course_Names,course_price},2,false),"")
=IF(isblank(order_id),"",SUM(D2:2))
=IFERROR(VLOOKUP('chosen_courses'!B2,{course_Names,course_price},2,false),"")
course_Names,order_id and course_price are named ranges.
This works well, at least for now.
But there is a problem:
I have 20 courses, so in the 2nd sheed, there are 21 columns. And I copy the formulas to 1000 rows because that is the maximum rows you can get to using ctrl+shift+↓ and ctrl+D. Now sometimes when I open the sheet, there will be a progress bar calculating formulas in this sheet, which could take around 2 mins, even though I have only like 5 testing orders in the sheet. I am afraid this will get worse when I have more datas or when it is open by old computers.
Is it because I use some resource consuming functions? Can it be improved?
I'm struggling with the following and help/guidance would be appreciated. The attached Google Sheet has 3 sheets;
Sheet1 has 2 data fields (month, store name).
Sheet2 has 4 data fields (month, store name, fruit, quantity)
A query on Sheet3 in cell A3 outputs a set of months and store names from Sheet1 which is then used to find quantities of a given fruit from Sheet2 (in this example, it's apples). The results are listed on Sheet3 in columns D and E. I used both Index(Match) and Filter to output the Apple quantities as i tried to figure out my ultimate goal - how to use a single formula, including the query itself, to get to the aggregate apple total in Row 9 (i.e. without needing to do all the index(match) or filter formulas). Said another way, what formula on Sheet3 in cell D9 would run the query against Sheet1, use the results to find the month, store name, fruit, and quantity matches on Sheet2, and total them for a single output cell on Sheet3 D9?
Thoughts?
You can use a combination of counta(query()) to do this.
For A1:A that contains a mixture of fruit (apples, bananas, grapes, star fruit), use:
=counta((query(A1:A, "select A where A like 'apple'")))
Check out this very simple example sheet
I'm trying to make a budget sheet for a trip.
I have 2 sheets in a Google Spreadsheet. One contains the steps of the trip. The other contains a dashboard with the sum for each of these 5 groups of steps: "food", "activities", "shopping", "hotels" and "vehicle".
My first sheet is like that (with 4 columns - the 3rd is the price):
1. Go to museum 45 Activity
2. Playing cards 5 Activity
3. Sleeping at Bohaha Hotel 123 Hotel
4. Take breakfast 10 Food
In the other sheet, I want to make different sums conditioned by the value of the 4th column, and using the values of the 3rd column.
The result of the second sheet in this example would be:
Food 10
Activities 50
Shopping 0
Hotels 123
Vehicle 0
How can I do that?
I can use a function if necessary.
Simple SUMIFS:
=SUMIFS(Sheet1!C1:C99, Sheet1!D1:D99, A1)
Assuming description in second sheet matches description in 4th column (the formula is not going to do the stemming for you to convert Activity to Activities - you can use 1 column for exact match string and 1 column as reporting label...)
I found the perfect formula :)
=SUM(FILTER('Sheet 1'!H5:H; 'Sheet 1'!G5:G="Food"))