I'm trying to search 3 different ranges in a tab, and trying to display Yes if all three values (email address, name, x) are found in those ranges. Basically, trying to have the formula confirm that yes, all three of those inputs are somewhere in those ranges (order doesn't matter).
Maybe I should use query or regexmatch or something? Any help is appreciated
Tried this formula:
=IF(AND('Helper Calculations'!$I:$I=$A$1,'Helper Calculations'!$J:$J=L$1,'Helper Calculations'!$L:$L=$A2),"Yes","No")
Was expecting that if the search term in each of those cells ($A$1, L$1, $A2) is found somewhere in the corresponding ranges, then it would say Yes
You can try with this (you can change the use of asterisks by wrapping in AND:
=IF(COUNTIF('Helper Calculations'!$I:$I,$A$1)*COUNTIF('Helper Calculations'!$J:$J,L$1)*COUNTIF('Helper Calculations'!$L:$L=$A2),"YES,"NO")
try:
=INDEX(IF(('Helper Calculations'!I:I=A1)*
('Helper Calculations'!J:J=L1)*
('Helper Calculations'!L:L=A2), "Yes", "No"))
Took a bit more work than I expected, but I got this working. I needed to verify that all 3 values were correct in a single row (must all be correct on that one row, can't find the correct values on multiple rows).
In order to do that, I needed to use array formula, and then decided to use index match and concatenate for the 3 values.
Process described here: https://www.ablebits.com/office-addins-blog/google-sheets-index-match/
correct formula: =IF(ArrayFormula(INDEX('Helper Calculations'!$I:$I,MATCH(CONCATENATE($A$1,L$1,$A2),'Helper Calculations'!$I:$I&'Helper Calculations'!$J:$J&'Helper Calculations'!$L:$L, 0),))=$A$1,"Y"))
Related
I have one spreadheet that includes name, id and amount of numbers data in it and i want to make the report in other spreadsheet.
i want to count the name column that is not blank, so i type this
=COUNTIF(importrange("gsheet link","Payroll 16-31 Jan!B3:B"),"<>")
but the result is "1" in fact that there are 3670 names on the column
=COUNTIF(importrange("gsheet link","Payroll 16-31 Jan!B3:B"),"<>"&"")
but still not working
can someone help?
I want to get the exact calculation of those data
Two things: have you connected the spreadsheets? If not, use IMPORTRANGE outside COUNTIF, something like =importrange("gsheet link","A1") . Accept the permissions and see if COUNTIF now does it right
If it doesn't, try with COUNTA that is specifically defined for counting non blank cells:. =COUNTA(importrange("gsheet link","Payroll 16-31 Jan!B3:B"))
I'd like to run a =SUM(A1:G1), but always skip one column, regardless if it has value or not.
In this case, it should calculate A1+C1+E1+G1.
Is there another function I could append to SUM() or other similar functions as SUM in order to skip one column?
Thank you!
Using the following method you can calculate any number of alternate columns, without the need of manual +
Suppose your data is in second row onwards, use this formula
=SUMPRODUCT(A2:G2, MOD(COLUMN(A2:G2),2))
Simply a sumproduct of cell values and a array of {1,0,1,0,1...}
Another slight variation
=SUMPRODUCT(A2:G2*ISODD(COLUMN(A2:G2)))
But if the even columns contain letters instead of numbers this will give an error, so you can use instead
=SUMPRODUCT(N(+A1:G1)*ISODD(COLUMN(A1:G1)))
Comparing #AnilGoyal's answer, this works as well
=SUMPRODUCT(A1:G1,--ISODD(COLUMN(A1:G1)))
You can use:
=SUM(INDEX(A1:G1,N(IF(1,{1,3,5,7}))))
Or with Excel O365:
=SUM(INDEX(A1:G1,{1,3,5,7}))
A bit more of a general solution:
=SUMPRODUCT(MOD(COLUMN(A1:G1),2)*A1:G1)
Or with Excel O365:
=SUM(MOD(COLUMN(A1:G1),2)*A1:G1)
Or even:
=SUM(INDEX(1:1,SEQUENCE(4,,1,2)))
Since you included Google-Sheets, I'll throw in an option using QUERY():
=SUM(QUERY(TRANSPOSE(1:1),"Select * skipping 2"))
Maybe a bit more verbose, but very understandable IMO.
Consider something of the format:
=SUM(A1:G1)-INDEX(A1:G1,2)
The 2 in the formula means remove the 2nd item in the part of the row. (so the 999 is dropped)
So the formula =SUM(BZ10:ZZ10)-INDEX(BZ10:ZZ10,2) drops CA10 from the sum, etc.(a similar formula can be constructed for columns)
google sheets:
=INDEX(MMULT(N(A1:H3), 1*ISODD(SEQUENCE(COLUMNS(A:H)))))
=INDEX(IF(ISODD(COLUMN(A:H)), TRANSPOSE(MMULT(TRANSPOSE(
IFERROR(A1:H3*ISODD(COLUMN(A:H)), 0)), 1^ROW(A1:A3))), ))
I'm trying to SUMIF data based on two criteria:
The title of the column (horizontal)
In between two dates (vertical)
I have tried a number of functions to solve this problem but to no avail.
I have tried functions with Match, Index, and Filter, but I couldn't make the function work.
As you can see in my code, I have found a workaround, but it is not ideal as it does not use the table header to identify the data values I'm looking for (see example function below for Product A).
=SUMIFS(B:B,A:A,">="&A$2,A:A,"<="&A$5)
I'm hoping for a function that can dynamically grab the values I'm looking for, based on the table header and the dates.
Thank you for any help you may provide.
You can also use index/match to select just the relevant column of the range (where a zero in the row parameter indicates the entire column):
=sumifs(index($B2:$D,0,match(F1,$B1:$D1,0)),$A2:$A,">="&$A2,$A2:$A,"<="&$A5)
=ARRAYFORMULA({B1:D1; TRANSPOSE(MMULT(
TRANSPOSE(FILTER(B2:D, A2:A>=A3, A2:A<=A5)),
TRANSPOSE(SPLIT(REPT(10,
COUNTA(FILTER(B2:B, A2:A>=A3, A2:A<=A5))), 1))^0))})
My Data
Summary Required :
enter image description here
Formula : =SUMIFS(INDIRECT("C"& MATCH(B15,$B$2:$B$10,0)+1 & ":" & "G"& MATCH(B15,$B$2:$B$10,0)+1),$C$1:$G$1,">="&DATE(2022,2,1),$C$1:$G$1,"<="&DATE(2022,2,28))
My table contains 2 sheets with a different number of columns. I want to add a column that will display true or false (or any other 2 opposite values ) for each row depending on whether this row satisfies 2 criteria which are: sheet1!col1=sheet2!col1 and sheet1!col2=sheet2!col2.
You'll find an illustration below.
I've tried using
ARRAYFORMULA(VLOOKUP(A1&B1, {Sheet1!A1:A4&Sheet1!B1:B4,Sheet1!C1}, 3))
but I get an error message
vlookup evaluates to an out of bound range
So I wanted to try
QUERY({Sheet1!A1:B4,A1:B5}, "Select C where ")
but I couldn't figure out how to write the condition where (sheet1)col1=(sheet2)col1 & (sheet1)col2=(sheet2)col2 and I also don't know if I can work with tables of different dimensions. I finally tried
=MATCH(A1&B1,{Sheet1!A1:A&Sheet1!B1:B})
but it always returns 1.
Any idea please?
Sheet 1
Sheet 2
Your first formula is almost right. You are getting the error message because there is only one column in the curly brackets so you have to change it to
=ArrayFormula(vlookup(A1&B1,{Sheet2!A:A&Sheet2!B:B},1,false))
and add the 'false' to make sure it only does exact matches.
To make the query work you need the right syntax to access cells in the current sheet:
=query(Sheet2!A:B," select A,B where A='"&A1&"' and B='"&B1&"'")
To make the match work, you need to enter it as an array formula and add a zero to specify exact match:
=ArrayFormula(MATCH(A1&B1,{Sheet2!A:A&Sheet2!B:B},0))
However I would take flak from my colleagues if I didn't point out that there is an issue with the vlookup and match as shown above - toto&moto would match with not just toto&moto, but also with tot&omoto etc. The way round this is to add a separator character e.g.
=ArrayFormula(vlookup(A1&"|"&B1,{Sheet2!A:A&"|"&Sheet2!B:B},1,false))
=ArrayFormula(MATCH(A1&"|"&B1,{Sheet2!A:A&"|"&Sheet2!B:B},0))
These still need some tidying up if they are to report Yes and No, and also not to give false positive on blank rows - also the vlookup and match can be written as self-expanding array formulas - but that is the short answer to the question.
I have a column XXX like this :
XXX
A
Aruin
Avolyn
B
Batracia
Buna
...
I would like to count a cell only if the string in the cell has a length > 1.
How to do that?
I'm trying :
COUNTIF(XXX1:XXX30, LEN(...) > 1)
But what should I write instead of ... ?
Thank you in advance.
For ranges that contain strings, I have used a formula like below, which counts any value that starts with one character (the ?) followed by 0 or more characters (the *). I haven't tested on ranges that contain numbers.
=COUNTIF(range,"=?*")
To do this in one cell, without needing to create a separate column or use arrayformula{}, you can use sumproduct.
=SUMPRODUCT(LEN(XXX1:XXX30)>1)
If you have an array of True/False values then you can use -- to force them to be converted to numeric values like this:
=SUMPRODUCT(--(LEN(XXX1:XXX30)>1))
Credit to #greg who posted this in the comments - I think it is arguably the best answer and should be displayed as such. Sumproduct is a powerful function that can often to be used to get around shortcomings in countif type formulae.
Create another list using an =ARRAYFORMULA(len(XXX1:XXX30)>1) and then do a COUNTIF based on that new list: =countif(XXY1:XXY30,true()).
A simple formula that works for my needs is =ROWS(FILTER(range,LEN(range)>X))
The Google Sheets criteria syntax seems inconsistent, because the expression that works fine with FILTER() gives an erroneous zero result with COUNTIF().
Here's a demo worksheet
Another approach is to use the QUERY function.
This way you can write a simple SQL like statement to achieve this.
For example:
=QUERY(XXX1:XXX30,"SELECT COUNT(X) WHERE X MATCHES '.{1,}'")
To explain the MATCHES criteria:
It is a regex that matches every cell that contains 1 or more characters.
The . operator matches any character.
The {1,} qualifies that you only want to match cells that have at 1 or more characters in them.
Here is a link to another SO question that describes this method.