My question is for Google Sheets
I am aware of the countif function and know how to count frequency of one value in a series but I am struggling to find frequency of multiple values in two series. I have tried countifs, arrayformula, countif + sum with and without array formulas but unable to succeed.
example
I have below series in E2:N2
31 32 35 45 49 55 57 66 72 75
and below series in O15:AH15
3 7 12 17 23 25 27 31 39 44 45 48 52 56 61 62 66 69 70 79
I want to see how many values matched and put that in cell A1
In the above example, 3 numbers matched so the value in A1 should be 3
I can do it with countif+countif+countif x 10 times but i wanted a very short formula.
Can someone give me some direction?
Thanks
Try
=SUMPRODUCT(TRANSPOSE(E2:N2)=O15:AH15)
This might serve you: Countifs in Google Sheets with various 'different than' criteria in same row adds +1 value
Basically is how to count based on criteria. there are even 2 sheets for you to check there and copy, you just need to change the criteria of words for the numbers you want to match and count.
Related
I'm trying to write a formula in Google Sheets which can first locate the row of a specific value. Then index to the value contained on that row a few columns over.
Let's assume the following
A B C
1 12 80
2 43 35
3 64 15
4 13 56
5 44 93
6 86 48
7 14 31
8 41 3
9 63 56
10 11 46
Values in column B and C have a correlated relationship. I need to first locate a specific value in column B than find it's corresponding value on the same row in column C.
For the sake of example, let's assume I'm trying to locate the row containing the value 41 in column B. And then would like to return the corresponding value in column C, which in this case would be 3.
The reason why I need a formula like this is because the data I'm using is highly variable and large. Over 4000 rows. It is unknown what rows the values to be found sit on.
You may try either:
=filter(C:C,B:B=D2)
OR
=xlookup(D2,B:B,C:C,)
filter() will output all instances of rows(column C) which has 41 in column B while xlookup will pick just the first match of 41 within the column
Trying to figure out a formula to automatically grade based on a range - for example, if the answer (number) in Column C is between...
70 - 94 = WTS
95 - 115 = EXS
116 - 140 = EXC
Sample data in column C:
76
96
95
123
115
I'd assume I'd put the formula in column D to get the outcome based on the range - so if the answer is between 70 and 94 I want column D to recognise this and put the response WTS. Following the rest of the ranges, I want to be able to use this formula for all data in the column.
Here is a link: https://docs.google.com/spreadsheets/d/1tLzm5u4tvWtDtNSxlN5COrkIm8w10_kyi7oobSzG5v8/edit?usp=sharing
Use XLOOKUP() function.
=XLOOKUP(C2,{70,95,116},{"WTS","EXS","EXC"},"",-1)
To spill results dynamically use XLOOKUP() with MAP() function.
=MAP(C2:C6,LAMBDA(x,XLOOKUP(x,{70,95,116},{"WTS","EXS","EXC"},"",-1)))
To refer full column as input try the following.
=MAP(C2:INDEX(C2:C,COUNTA(C2:C)),LAMBDA(x,XLOOKUP(x,{70,95,116},{"WTS","EXS","EXC"},"",-1)))
try:
=MAKEARRAY(COUNTA(C2:C),1,LAMBDA(r,c,VLOOKUP(INDEX(C2:C,r),INDEX({--REGEXEXTRACT(G:G,"^\d+"),REGEXEXTRACT(G:G,"[A-Z]+$")}),2,1)))
-
I have data like below in google sheets
A B C
1 82 54.73
2 20 58.32
4 78 57.84
3 21 58.58
2 20 55.05
3 20 54.55
1 20 49.63
4 21 43.65
2 33 43.65
5 19 45.87
In this column A can have repeated values
I want to list the rows with same column A values together and order by column B and get below output
A B C
1 20 49.63
1 82 54.73
2 20 58.32
2 20 55.05
2 33 43.65
3 20 54.55
3 21 58.58
4 21 43.65
4 78 57.84
5 19 45.87
Can this be achieved using google sheets. If so please suggest the formula to achieve same.
or try:
=QUERY(A1:C; "where A is not null order by A,B"; )
Use the SORT function. Like this:
=sort(A1:C10,1,1,2,1)
I think I’ve ‘over thought’ my problem so I’m starting from the beginning again.
I have two spreadsheets, one is an original database (org_DB) and the second is the updated database (new_DB). The number of rows is around 15,000 for org_DB and 18,000 for new_DB. The number of relevant contiguous columns is exactly 14 in both.
I need a third sheet, the results, that contains only the new_DB entries that are DIFFERENT from the original database, and, all new_DB entries that are ADDITIONAL.
The definition of DIFFERENT is a row with greater than 0 differences.
The definition of ADDITIONAL is a row that has no equivalence.
I think I need the two definitions because ‘new DB’ is longer than ‘org DB’ and all my formulas fail at the end point of org_DB.
The two test sized DB are:
org_DB
Code 1 Code 2 Code 3 Code 4
AA00001 AAGA 1180218 24
AA00007 AAGA 03821787-97 58
AA00008 AAGA 11821260-99 59
AA00009 AAGA 11001017 60
AA00016 AAGA 3801648 67
AA00017 AAGA 3801649 120
AA00018 AAGA 3801692 66
AA00019 AAGA 03821084-61 70
new_DB
Code 1 Code 2 Code 3 Code 4
AA00001 AAGA 1180218 24
AA00008 AAGA 11821260-99 59
AA00009 AAGA 11001015 60
AA00016 AAGA 3801648 67
AA00017 AAGA 3801649 120
AA00018 AAGA 3801692 69
AA00019 AAGA 03821084-61 70
XX00101 XXGA 1234X567X 101
XX00102 XXGB 1234X567X 101
Result DB (the result I am looking for)
AA00009 AAGA 11001015 60
AA00018 AAGA 3801692 69
XX00101 XXGA 1234X567X 101
XX00102 XXGB 1234X567X 101
For row comparison (which works on a row by row basis) I’m using
=if(ArrayFormula(sum(--(new_DB!A2:D2=org_DB!A2:D2)))<>4,"Copy row","Ignore")
To get the result array I’m using
=filter(new_DB,if(ArrayFormula(sum(--(new_DB=org_DB)))<>4)
Problem 1 is that the FILTER condition argument only gets a single formula result from the ArrayFormula so fails with an #N/A - “FILTER has mismatched range sizes. Expected row count: nn, column count: 1. Actual row count: 1, column count: 1.”
Problem 2 is that the ArrayFormula after IF is comparing 1 row and nn columns - which I want. Wrapping the whole function in another ArrayFormula gives even stranger results.
Problem 3. Changing the row comparison function from IF ArrayFormula to SUMPRODUCT produces the wrong result when used in a ArrayFormula wrapper.
I can see that if that if I use this method then the recursion process is likely to be very lengthy - so I've come to accept my method is fundamentally flawed. Should I use a VLOOKUP and FILTER combo for column A. Column A is actually a SKU ID so should always be unique.
Can anyone help please. TIA
Note that org_DB row 3 (AA0007...) is not in the results. Deliberate.
Test sheet here: Test DB Sheet
This will look really ugly really quickly with a lot of columns which is why I'm asking of you have any columns you can limit yourself to.
=ARRAYFORMULA(FILTER(
'New DB'!A2:D10,
ISERROR(MATCH('New DB'!A2:A10 & "|" &
'New DB'!B2:B10 & "|" &
'New DB'!C2:C10 & "|" &
'New DB'!D2:D10,
'Org DB'!$A$2:$A$9 & "|" &
'Org DB'!$B$2:$B$9 & "|" &
'Org DB'!$C$2:$C$9 & "|" &
'Org DB'!$D$2:$D$9,
0))))
This filters the content of New DB by whether the concatenated columns of New DB can be found in Org DB, you can use any other Delimiter if you have | in there.
I have a table of foods with their nutritional values in a Google Sheets. My objective is to enter portions consumed of each food in a given day and calculate nutritional intake for the day. For each row that has a portion entered, I want to summarize the nutritional values times the number of portions served. I've given a very simplified version below.
Can anyone tell me how to go about doing this in Google Sheets?
PORTIONS FOOD CALORIES FAT PROTEIN
1 beef 250 34 25
chicken 220 22 13
carrots 20 12 23
2 beans 40 25 5
--------------------------------------------
TOTALS 330 84 35
In C6 place:
=sumproduct($A2:$A5,C2:C5)
Then copy across to D6 and E6