I'm not sure if I've written it wrong, or if its even possible, but is there a way to SUMIF if there is a single criteria you want to across multiple columns. Such as find that criteria in column A B or C? Here is an example of my sumif statement.
=SUMIFS(Events!F:F, Events!K:K, "2 Meat", Events!L:L, "Pulled Pork", Events!M:M, "Pulled Pork",Events!N:N, "Pulled Pork", Events!D:D, "="&TODAY())
I need the bold area to be if column L says Pulled Pork OR column M says Pulled pork OR... etc. I'm hoping I've just written it incorrectly.
try:
=SUMIFS(Events!F:F, Events!K:K, "2 Meat",
REGEXMATCH(Events!L:L&Events!M:M&Events!N:N, "Pulled Pork"), TRUE,
Events!D:D, TODAY())
Awesome question! You can add multiple SUMIFS together in this instance to supplement an OR method, which I believe cannot be applied to SUMIFS. (copy/paste will be your friend here)
Example Formula:
=SUMIFS(Events!F:F, Events!K:K, "2 Meat", Events!L:L, "Pulled Pork", Events!D:D, "="&TODAY())+
SUMIFS(Events!F:F, Events!K:K, "2 Meat", Events!M:M, "Pulled Pork", Events!D:D, "="&TODAY())+
SUMIFS(Events!F:F, Events!K:K, "2 Meat", Events!N:N, "Pulled Pork", Events!D:D, "="&TODAY())
This can also be done in separate cells and then summed together for a quicker approach.
You CAN, however, apply OR conditions to filter formulas by wrapping conditions in parenthesis and including a '+' sign in-between them, like so:
=SUM(FILTER(F:F, D:D=TODAY(), K:K="2 Meat", (L:L="Pulled Pork")+(M:M="Pulled Pork")+(N:N="Pulled Pork")))
Here's an example image of the results:
Related
I have more than 1000 columns and rows. I need to calculate the total numbers only from specific names (in this case the total of numbers which are highlighted on the pictures )
There are multiple way to do this. Try FILTER() then SUM() formula.
For Alice =SUM(FILTER(C2:E5,A2:A5="Alice"))
For alice+Bob =SUM(FILTER(C2:E5,A2:A5="Alice"))+SUM(FILTER(C2:E5,A2:A5="Bob"))
For bob =SUM(FILTER(C2:E5,A2:A5="Bob"))
Another way is to use SUMPRODUCT() like
=SUMPRODUCT((C2:E5)*(A2:A5="Alice"))
=SUMPRODUCT((C2:E5)*((A2:A5="Alice")+(A2:A5="Bob")))
=SUMPRODUCT((C2:E5)*(A2:A5="Bob"))
In case you have many criteria or the number of criteria varies, you may consider to use QUERY
Assuming the criteria are on B1002:1002 (i.e. B1002: Alice, C1002: Bob, D1002: Ted) and the table is A1:AA1000
=ArrayFormula(SUM(QUERY({A1:AA1000},"select sum(Col"&TEXTJOIN(")+sum(Col",TRUE,IF(B1:1="",,COLUMN(B1:1)))&") where Col1='"&TEXTJOIN("' or Col1='",TRUE,B1002:1002)&"' group by Col1",1)))
something more advanced.... you can use this formula in all of your 3 cases:
=SUM(FILTER(C$2:E$5*1, REGEXMATCH(LOWER(A$2:A$5), TEXTJOIN("|", 1, IFERROR(
REGEXEXTRACT(LOWER(SPLIT(A8, " ")), TEXTJOIN("|", 1, LOWER(A$2:A$5))))))))
spreadsheet demo
I'm trying to figure this out for the last one hour in Google...
In column B:B might be different strings "A", "B", "C".
In column C:C might be different values 1, 2, 3.
So, I want in column D:D 9 different string outputs "A1", "A2", "A3", "B1", "B2" and etc. depending on these three conditions.
As a basic one, I'm trying to do 2x2:
=IF(AND(B:B="A", C:C=1), "A1", IF(AND(B:B="A", C:C=2), "A2", IF(AND(B:B="B", C:C=1), "B1", IF(AND(B:B="B", C:C=2), "B2"))))
Please, can tell me what's wrong...
=ARRAYFORMULA(SORT(
TRANSPOSE(SPLIT(REPT(CONCATENATE(B1:B&CHAR(9)), COUNTA(C1:C)), CHAR(9)))&
TRANSPOSE(SPLIT(CONCATENATE(REPT(C1:C&CHAR(9), COUNTA(B1:B))), CHAR(9)))))
I'm using Google Spreadsheets, and I have information populating the sheet through a Form. The data comes through as a timestamp, text, text separated by commas and number separated by commas (Columns A, B, C and D, respectively). Here's a link to a simplified example sheet I made to show my problem.
What I want to do is have the Week in B listed as many times as there are activities. So In B2, it says "Week 2", and in C2 there is "Running, Skiing", and so I would like "Week 2" to be written twice going down. In C3, there is only one activity, so I would only want "Week 2" to be written once this time. In the "I" column I showed what I would like to happen.
What I can do (Column G) is use a combination of Transpose, Split and Rept functions to list B2 (Week 2), F2 amount of times (twice). However, at an arbitrary distance below, I then want to repeat the same the same thing with B3 and F3, and so on and so on. I think I need to use ArrayFormula function, but I don't exactly understand how to in this scenario.
Hope I explained my problem properly, if any more information is needed I'll provide it, thanks.
Erase D column. Rewrite D column.
G2:
=REPT(B2&", ", F2)
Drag fill down.
This should give your table:
=ARRAYFORMULA(TRANSPOSE(SPLIT(TRANSPOSE(QUERY({G2:G5& ", ",C2:D5 & ","},, 500000)), ", ", 0)))
I know how conditional formatting works, but I don't know how to implement a specific formula. For example, I want the cell to be highlighted if any of the animals below is mentioned. I was thinking of creating a conditional formatting rule for each of them, but I think that's not efficient. There has to be a simpler formula.
Aardvark
Abyssinian
Adelie Penguin
Affenpinscher
Afghan Hound
African Bush Elephant
African Civet
African Clawed Frog
African Forest Elephant
African Palm Civet
African Penguin
African Tree Toad
African Wild Dog
Ainu Dog
Airedale Terrier
Akbash
Akita
Alaskan Malamute
Albatross
Aldabra Giant Tortoise
Alligator
Alpine Dachsbracke
American Bulldog
American Cocker Spaniel
Here's an example. My goal is to highlight Column E's cells if any of the words match any item in Column A.
I think this will solve your problem. In F2, put this. It creates the join needed for the OR needed in the regexmatch.
=transpose(join("|",indirect("A2:A"&counta(A:A))))
In G2 put the following which returns a 1 (true) or 0 (false) for a match from the list in column A.
=arrayformula(if(E2:E<>"",(sign(REGEXMATCH(E2:E,""&F2&""))),""))
In conditional format, put the custom formula:
=AND(E2<>"",G2=1)
Apply to range E2:E.
This is a copy of my test spreadsheet:
https://docs.google.com/spreadsheets/d/1AwQBRtB_8QMbKxQLGzwE0y3RTlO6CyM6sGcUmCc5iQ8/edit?usp=sharing
Sorry it took so long to work it out.
I am not certain if excel can do this but I am trying to simplify the data dump that I get from twitter.
Basically what I would like to do is this:
If the tweet (in Column A) contains apple OR orange OR pear then it can be classified (in Column B) as "fruit" BUT if it has carrot OR squash OR lettuce it will be classified as "vegetable". If it has none of these then can be classified as "none"
Is this possible?
Thanks in advance.
Here is using array constant and range.
=IF(SUMPRODUCT(IF(ISERROR(SEARCH({"apple","orange","pear"},A1)),0,1))>0,"Fruit",IF(SUMPRODUCT(IF(ISERROR(SEARCH({"carrot","squash","lettuce"},A1)),0,1))>0,"Vegetable","None"))
Now for example, both fruit and vegetable are present in a string, it will always test for fruit first since that is the way the formula was arranged. (e.g. "more apple on salad than lettuce" will return "Fruit").
You can also use a range that contains your list instead of the array constant.
For example, you can put your fruit list in Column C (C1:C3) and your vegetable list in Column D (D1:D3). Your formula would then be:
=IF(SUMPRODUCT(IF(ISERROR(SEARCH(C$1:C$3,A1)),0,1))>0,"Fruit",IF(SUMPRODUCT(IF(ISERROR(SEARCH(D$1:D$3,A1)),0,1))>0,"Vegetable","None"))
But you need to enter it as Array Formula using Ctrl+Shift+Enter.
Same results and rule apply when both fruit and vegetable appear on a string. HTH.
Sure.
Try this formula
=IF(
OR(
NOT(ISERROR(SEARCH("apple",A1))),
NOT(ISERROR(SEARCH("pear",A1))),
NOT(ISERROR(SEARCH("orange",A1)))
),
"fruit",
IF(
OR(
NOT(ISERROR(SEARCH("carrot",A1))),
NOT(ISERROR(SEARCH("squash",A1))),
NOT(ISERROR(SEARCH("lettuce",A1)))
),
"veggie",
"none"
)
)