I'm looking to count the groups that have at least one occurrence of specific text values in a column. E.g., if any of term_01, term_02, or term_03 are in column B, for 1 or more records associated with a specific value in column A, count 1.
This is not too difficult with a helper column, but I'm trying to do it in one go, with a single formula.
Another way to think about this is that unless every record for a given column A value (e.g. group_01) has a value of term_04 in column B, add 1 to the value displayed in cell I1.
Solution with a helper column:
The helper can be created with an array formula:
Unfortunately, replacing the [sum_range] in SUMIF() with an array fails with "Error: Argument must be a range"
Is there a way to pass an array of values to SUMIF() instead of a range? Am I going about solving this problem the wrong way?
I would still be interested to know if there's a general solution to the question asked in the title, but I solved this specific problem with a slightly different approach.
If the number of records with a term_04 value equals the total number of records for that group, assign 0, otherwise assign 1, and sum the result.
=ArrayFormula(SUM(IF(COUNTIFS($D$3:$D$10, UNIQUE(D3:D10), $E$3:$E$10, $A$6)=(COUNTIF($D$3:$D$10, UNIQUE(D3:D10))), 0, 1)))
Related
I'm an average user of Google sheets and I've tried writing/looking up the formula I'm going for, but I haven't had any luck yet.
I have a spreadsheet that details multiple values that I need to display in a single cell the average of a certain set of values derived from a specific set of those values from multiple columns.
The flow of information would look something along the lines of:
if value in Column D=L
then
if value in Column J<$1.20
then
Find Avg of all Values in Column N
I'd need the formula to narrow it's field of data each time so the final result was the average of all the values in Column N that had a value in column J<$1.20 with a value in Column D=L.
I feel like a dummy over here because I just can't narrow down how I should write this flow and get it to work right without adding multiple extra hidden columns. Can anyone help on this one?
I've tried writing the formula multiple different ways but haven't kept it written down to pass on.
I have one table with a list which includes a reference cell with 1-more items separated by a comma.
I have another table with a list of all reference items, and a column with a value.
What is a way to create a formula that compares each item in the reference cell against the reference list, and if there is a match, returns the sum of the reference items value.
See this table
i.e. match column V to B, and if there is a match, sum column Y.
Thanks
Reza
I was struggling to find a way to search for a method to do this so though I would just ask.
I hope to explain clearly what I'm trying to do.
I have some data in column B, grouped as shown in column A.
I'd like to count the unique values for each group present in column A, not taking into account the unique values already counted in the previous group(s).
For instance, I'd like to:
count unique values in 'proyecto2' NOT COUNTING the unique values already present in 'proyecto1'.
count unique values in 'proyecto3' NOT COUNTING the unique values already present in 'proyecto1' and 'proyecto2'.
count unique values in 'proyecto4' NOT COUNTING the unique values already present in 'proyecto1', 'proyecto2' and 'proyecto3'.
and so on...
Below you can find a Google Sheet with the solution I found, even if I'm not very happy with it, to show easily what I mean.
https://docs.google.com/spreadsheets/d/1x8S76_6dUnHr1NtUbzNzpLTpQtqan6_ohemcrGsrpC0/edit#gid=0
Basically, in column A:B, we have the INPUT DATA. You can add data in column A and B to see how it works (my method, at the moment, only work if you add one of these groups in column A: 'proyecto1', 'proyecto2', 'proyecto3', 'proyecto4', 'proyecto5' and 'proyecto6').
In column D:E, we have the output data, basically, the unique values counted by the group.
In column G:W, the formula to process the data.
Clearly, my method is working up to 'proyecto6' since in the "processing columns" I'm taking into account formula only up to 'proyecto6'.
Everything is working but my question is: could you suggest me a more dynamic way of achieving what I'm trying to do? Or the only way is to write some code?
delete everything in range D:Z
paste to D2 cell:
=UNIQUE(A2:A)
paste to E2 cell:
=ARRAYFORMULA(IF(LEN(D2:D);
MMULT(IFERROR(LEN(G2:Z)/LEN(G2:Z); 0); TRANSPOSE(COLUMN(G2:Z2)^0)); ))
paste to G2 cell:
=TRANSPOSE(UNIQUE(FILTER(B$2:B; A$2:A=D2)))
paste to G3 cell and drag down:
=TRANSPOSE(UNIQUE(FILTER(FILTER(B$2:B; A$2:A=D3);
NOT(COUNTIF(INDIRECT("G2:"&ROW()-1); FILTER(B$2:B; A$2:A=D3))))))
In gspread, is it possible to get the last row or cell number that is filled?
The API reference page doesn't seem to help.
Gspread has "row_count", but I am not sure it returns all rows in a spreadsheet, or just the filled ones. If that doesn't help, there is a slightly less direct, but completely functional way to do it:
1.) let's assume your data is in column A, and it has been filled in consecutively row by row (i.e. no skipped rows)
2.) in another free cell in your spreadsheet--let's assume cell B1--use the native Google Sheets function COUNTA, which will count the number of values in a dataset, and specify column A as the target, i.e. "=COUNTA(A:A)"
3.) now just request the value of cell B1 with gspread's acell, i.e. "last_row_updated = myWorksheet.acell("B1").value"
You can use the following code, taken from this answer to this similar question:
def last_filled_row(worksheet):
str_list = list(filter(None, worksheet.col_values(1)))
return len(str_list)
I'm creating a dashboard in Excel 2010 that uses the VLOOKUP function to call another sheet's values.
The equation I'm using is this:
=VLOOKUP(L$1,Sheet_B!$A:$H,7,2)
L$1 asks for a unique identifier on Sheet_A, and then finds that ID on Sheet_B and then finds the corresponding data and pulls it.
The problem is this:
If I do nothing to Sheet_B, I'll get a value - let's say 5. This value is incorrect.
If I sort Sheet_B from A-Z alphabetically (which doesn't change the data) I'll get a totally different value - let's say 12 - which is the correct value.
The problem is that the data that the VLOOKUP function examines hasn't changed, only how it was sorted in Sheet_B.
Is there any reason why this might happen? And more importantly, how can I fix it so I don't have to keep sorting Sheet_B every time I pull this dashboard?
If your 4th parameter equals True (2 in your case), VLOOKUP tries to find an approximate match, so you need the values in the first column of table_array to be placed in ascending order.
If you change it to 0 (equivalent to False), VLOOKUP will try to find an exact match, and so will not need to be sorted.
Therefore, you should change your VLOOKUP to:
=VLOOKUP(L$1,Sheet_B!$A:$H,7,0)
You can read more in this Microsoft Office Support article..