Using COUNTIF excluding duplicates in the same column - google-sheets

I'd like a formula to be able to calculate a COUNTIF function, but ignoring duplicate values in the same column. My sheet looks something like this:
For example, if I were to count the number of occurrences of "Grass" it would return a result of 4, ignoring the duplicates in columns C and D.
Link to this spreadsheet - https://docs.google.com/spreadsheets/d/110De2u6mKLT7SOTfaXN6EZVqgD35pEeeog9o5WWn5bs/edit?usp=sharing

There is a new sheet on your sample spreadsheet called MK.Idea. There you will find this formula:
=ARRAYFORMULA(COUNTIF(UNIQUE(SPLIT(FLATTEN(Sheet1!B1:G1&"|"&Sheet1!B2:G),"|")),"Grass"))
That uses UNIQUE and a SPLIT(Flatten technique to isolate the "grass" values that are duplicates in a given column

Related

Importing values of column from other sheet based on a matching values in a different column across both sheets?

Hey Stack Overflow Sheets, I have a question regarding a use case we want to create in our Google Sheet, either with built-in functionality, or with an extension like Sheetgo.
We have 2 sheets with multiple of the same columns (properties) and rows (users). The problem is that only one of the sheets is a trusted source for one column’s data (“source sheet”), and the other sheet has empty or outdated values for the same column (“outdated sheet”), and we need both sheets to have this column match values in rows that have a matching value for another column across both sheets (in our case, an “email” column). After they’re matching, we want to change the formula to sync any changes made for that column between both sheets.
Here’s an obfuscated data example:
Source sheet:
https://docs.google.com/spreadsheets/d/1uxqC3lB15UHhKTzjZyzzVIj5tlPjhCCCZ48xHYEcm0o/edit?usp=sharing
Outdated sheet:
https://docs.google.com/spreadsheets/d/1ckoCh8gMwt2QeBRH1dB2dyFPJUukrjQ-SCgucTL8rhc/edit?usp=sharing
In the example, we’re looking for a formula that would allow us to have a “Type” column value injected into the Outdated Sheet’s Type column, based on both sheet’s matching Email column value. And then, have it so if a row’s “Type” value changes in either doc, the other doc follows.
What formula or extension would I use to go about this? Any help appreciated, thanks!
I tried to create a VLOOKUP and MATCH formula, but I couldn't yet figure out how to have the function first LOOKUP into the Source Sheet, then inject it into the Outdated Sheet based on a matched email column value. Sheetgo made the LOOKUP easier, but I still couldn't figure out how to do an exact operation.
Use importrange() and vlookup(). Put this formula in cell A1 of the target spreadsheet:
=arrayformula(
lambda(
import,
iferror(
vlookup(
C1:C,
{ index(import, 0, 3), index(import, 0, 1) },
2, false
)
)
)(
importrange("1uxqC3lB15UHhKTzjZyzzVIj5tlPjhCCCZ48xHYEcm0o", "Sheet1!A1:F")
)
)

Google Sheets: VLOOKUP: Named Ranges - Insert/Move Columns

I'm doing performance calculations on an America's Cup AC75 yacht, and have found Named Ranges very helpful in equations I use.
On a 'Data' sheet, I now have a lot of information that I'd like to reference as a Named Range, and use via VLOOKUP(), in my 'Analysis' sheet.
A problem I have struck is that if I need to Insert/Move a column in this new Named Range, the VLOOKUP function does not "update" the column that it should return.
For example, if a cell value is "=VLOOKUP(B6, Sail_Vectors, 10, false)", but I have to insert a new column before col 10 in the Named Range "Sail_Vectors", the desired column becomes col 11 - but the lookup still returns col 10, which is now incorrect.
I may be asking too much, but just wondering if anyone might have a work-around, or something I've overlooked?
If your sheet Data has headers, you can use them in order to reference your desired column dynamically, using MATCH:
=VLOOKUP(A1,Sail_Vectors,MATCH("Header C",Data!1:1),false)
Sheet Analysis:
Sheet Data:

Generate all possible combinations for 3 Columns in Google Sheets

I have a Google Spreadsheets with four columns.
I need to populate the Column D with all the possible combinations of the values in Columns A and C. Please take a look a the capture to see what I mean.
I found this following formula, but it use for 2 column.but i have 3 column.
i am using this code:
=ArrayFormula(transpose(split(concatenate(rept(A1:A&char(9),counta(B1:B))),char(9)))&" "&transpose(split(rept(concatenate(B1:B&char(9)),counta(A1:A)),char(9))))
use:
=INDEX(FLATTEN(FLATTEN(
FILTER(A2:A; A2:A<>"")&" "&TRANSPOSE(
FILTER(B2:B; B2:B<>"")))&" "&TRANSPOSE(
FILTER(C2:C; C2:C<>""))))
Answer:
You can pass this formula back into itself to get the same result for three columns.
Formula:
=ArrayFormula(transpose(split(concatenate(rept(A1:A&char(9),counta(ArrayFormula(transpose(split(concatenate(rept(B1:B&char(9),counta(C1:C))),char(9)))&" "&transpose(split(rept(concatenate(C1:C&char(9)),counta(B1:B)),char(9))))))),char(9)))&" "&transpose(split(rept(concatenate(ArrayFormula(transpose(split(concatenate(rept(B1:B&char(9),counta(C1:C))),char(9)))&" "&transpose(split(rept(concatenate(C1:C&char(9)),counta(B1:B)),char(9))))&char(9)),counta(A1:A)),char(9))))
This formula replaces the references to B1:B to a formula which transposes all combinations of column B and column C, and transposes all those combinations with those in column A.

Query Formula gives values that can't be summed using =sum()

So I have two query formulas:
=iferror(QUERY(IMPORTRANGE('Index Sheet'!$C$2,"Table 1!A1:Z1000"),"Select sum(Col7) where Col1 = """&$A5&""" label sum(Col7)''",0))
and it repeats for every row with the A5 being dynamic reference.
I am also using the query select formula:
=iferror(QUERY(IMPORTRANGE('Index Sheet'!$C$3,"Table 1!A1:Z1000"),"Select Col7 where Col1 = """&$A5&""" label Col7''",0))
When I try to use the query sum formula it says AVG_SUM_ONLY_NUMERIC for most of the sheets I am referencing, so I'm forced to use the query select formula instead.
So long story short I am trying to sum certain certain parts of columns in this new sheet (eg. H10:H15), but the sums are not summing, they just return a "-". Please see my screenshots below:
Original Source (sheet the queries are referencing):
New sheet query example:
New sheet I am trying to get the values over to (see sum function of D18):
The =sum() functions work when I use the query Sum to get the values, but for certain original sheets I can't use query sum because of AVG_SUM_ONLY_NUMERIC (some of the columns are merged etc.). So basically, forgive my poor explanation, how do I get to sum up these queried values if the query sum function can't put the values in the cells because of AVG_SUM_ONLY_NUMERIC, and the query select function are returning values that even though they appear like numbers can't be summed. I can't change the original sheets.

Arrayformula not working with index and match google sheets formula

I have data in three columns. Column A contains a list of fruits. The second column the rank (1,2,3...) and the third column a list again but this time ordered by preference.
I want to return the rank in the fourth column. I have tried this formula which works as it should but it's returning just one value yet it's an array formula. What could be missing?
=ARRAYFORMULA(index(B2:B11,match(A2:A,C2:C11,0)))
Link to my spreadsheet.
https://docs.google.com/spreadsheets/d/1e7xCcdPa3MywDVs70o2kXAwMnzJRMDuucktWPowS_MY/edit?usp=sharing
Index doesn't work with array formulas so you have to use Vlookup instead:
=ArrayFormula(if(C2:C="","",vlookup(C2:C,A2:B,2,false)))

Resources