How to exclude multiple strings from SUMIFS - google-sheets

I have this formula here:
=SUMIFS(SalesData!$N:$N, SalesData!$B:$B, "FirstName LastName", SalesData!$D:$D, "<>"&A1:M1)
But the last part "<>"&A1:M1 doesn't work correctly. If I set it to a specific cell, e.g. "<>"&F1, that works fine. Is there a way to select the entire range of A1:M1?

try:
=SUM(FILTER(SalesData!N:N, SalesData!B:B="FirstName LastName",
NOT(REGEXMATCH(SalesData!D:D&"", TEXTJOIN("|", 1, A1:M1)))))

Related

Comparing string with

In Google Sheets, I'm trying to indicate whether each cell in a specific column (the "Target Column") contains any of the words listed in a group of cells (the "Word Warehouse"), organized into different "Categories". If the word appears in the Word Warehouse, I would like the cell to spit out the category that it's listed under, e..
See attached sheet here: https://docs.google.com/spreadsheets/d/10jiicpOpplaURrF0UtTi9HM2TFP04-tinynpnFef2mE/edit#gid=0
Thanks in advance!
Try:
=INDEX($2:$2,1,MAX((ISNUMBER(SEARCH(IF(LEN($D$3:$F$7),$D$3:$F$7),A3))*COLUMN($D$3:$F$7))))
Alternatively, you can also try
=ArrayFormula(iferror(VLOOKUP(regexextract(proper(A2:A), textjoin("|", 1, D2:F)), split(flatten(D2:F&"_"&D1:F1),"_"), 2, 0)))
This formula allows for an array output, so dragging down is not necessary.

Query to select a large range of columns without manually entering each column Google Sheets

I am using the solution presented in this post:
https://webapps.stackexchange.com/questions/101926/google-sheets-query-to-select-a-large-range-of-columns-without-manually-entering
But now I need to query data from a different spreadsheet. I know the importrange requires the use of 'Col' to specify the column. However, I don't know how to change this string:
=arrayformula(join(",", substitute(address(1, column(C:F), 4), "1", "")))
you can use:
=ARRAYFORMULA(JOIN(",", "Col"&COLUMN(C:F)))

How to use variable range in Google Sheets?

Currently I have such formula:
COUNTIFS(B3:B36,"16",E3:E36,"01")
Would it be possible to turn these ranges B3:B36 and E3:E36 into variables, like B'start_cell_value':B'stop_cell_value'.
The whole thing would look like:
=COUNTIFS(B'start_cell_value':B'stop_cell_value',"16",E'start_cell_value':E'stop_cell_value',"01")
start_cell_value and stop_cell_value are just some numbers stored in a separate cell. This would help, since changing numbers in those cells only would also change everything in the formula and that's exactly what I want.
I have tried to combine a numeric value from other cells with a letter to make a valid cell name but it doesn't seem to work or it just throws a reference error.
Any ideas would be appreciated.
If you have the start_cell_value in cell A1 and the stop_cell_value in A2 then try this formula:
=COUNTIFS(INDIRECT("B"&A1&":B"&A2),"16",INDIRECT("E"&A1&":E"&A2),"01")
with Named Ranges you can have it even exact:
=COUNTIFS(INDIRECT("B"&start_cell_value&":B"&stop_cell_value), "16",
INDIRECT("E"&start_cell_value&":E"&stop_cell_value), "01")
=COUNTIFS(INDIRECT("B"&A1&":B"&A2), "16",
INDIRECT("E"&A1&":E"&A2), "01")

Conditional formatting with custom formula

I cannot seem to make my conditional formatting work with a custom formula. The long and short of it is that the formatting is based on some VLOOKUPs. I've tested the formula in a normal cell and it outputs 1 as expected.
=IF(REGEXMATCH(VLOOKUP(C5,CL!C2:H99,5,FALSE), VLOOKUP(B5,CL!J3:K110,2,FALSE)), 1, 0)
I'm basically testing to see whether a certain tag is included in a cell that contains a comma separated list of tags.
The documentation seems to suggest that I need to enter the formula into the box with quotation marks around it (""). I've tried all variations I believe.
I've also tried removing the IF statement, as REGEXMATCH outputs true or false.
Any clue why this isn't working?
when attempting conditional formatting to reference another sheet you need to wrap it into INDIRECT - that's where Google documentation failed. try:
=IF(REGEXMATCH(VLOOKUP(C5, INDIRECT("CL!C2:H99"), 5, 0),
VLOOKUP(B5, INDIRECT("CL!J3:K110"), 2, 0)), 1)

How to maintain the original header name when performing Google Sheets Query

Hi I have this working query that loops through an arbitrary range of data and produces the results I need:
=arrayformula(QUERY(Crew!A:DY,"SELECT E,A," & join(",", substitute("Count(`1`)", "1",substitute(address(1, column(Crew!F:DY), 4), "1", ""))) & "GROUP BY E,A", 1))
Unfortunately, this produces Columns that are labeled so:
count 18/12/2017 count 25/12/2017 count 01/01/2018
I need to force a display of the original column name, and if possible, the format, e.g. 18/12/2017 as this will allow me to perform further pivot or group by month type functions
I have experimented with different methods of adding a label at the end of the query, reduced the query to tests of the data without using the arrayformula, and searched through the queryLanguage Docs but all references seem to be related to applying a different text string rather than leaving the column header 'raw'
I suspect the main problem is my inexperience, I don't know the correct terms to search for?
How do I achieve this?
Cheers.
You need to use label construction:
"select ... where ... group by ... label ..."
Reference:
https://developers.google.com/chart/interactive/docs/querylanguage#label
You may get labels text with the formula:
="label "&ArrayFormula(join(", ",substitute("count(`1`) ", "1",substitute(address(1, column(F1:G1), 4), "1", ""))&text(F1:G1," 'dd/mm/yyy'")))
change F1:G1 to your range.
The shorter version of the formula with Regex:
="label "&ArrayFormula(join(", ",REGEXREPLACE(ADDRESS(1,COLUMN(F1:G1),4),"(.*)\d+$","count(`$1`) "&TEXT(F1:G1,"'dd/mm/yyy'"))))

Resources