I am using the formula = C2 + B2 <> A2 to highlight the cells where this condition is true. For some reason, this formula does not work correctly in some cells. For example, in cells C1, C17.
Please understand the reason.
All numbers in columns A through C are integers.
Your formula is using relative references, but not the right ones. In row 1 you want to compare the values in row 1, in row 2 values of same row and so on.
In your image you've selected C1 and the rule there should be = C1 + B1 <> A1, not = C2 + B2 <> A2
C1 is being highlighted because C2 + B2 is not equal to A2. 12115+460=12575, which is different from 12573.
Same for C17. Your conditional formula is looking 1 row below. Try using
= C1 + B1 <> A1
Related
I have a Google spreadsheet with a tab called 'Updates'. In a separate tab, I want to use drop-down menus (contained in cells B3, B4 and B5 in the code below) to filter and subsequently view the data in the 'Updates' tab according to its text in columns B, C and D.
I have written the following code. Basically I want to be able to filter the data according to selections made in all 3 drop down menus (B3, B4 and B5), or just in two of them (e.g. B3 and B4, but B5 is left blank), or just in one of them (e.g. B3, and B4 and B5 are left blank).
=query(Updates!A1:E, " select * (where B = '"&B3&"' AND C = '"&B4&"' AND D = '"&B5&"') OR (where B = '"&B3&"' OR C = '"&B4&"' OR D = '"&B5&"') OR (where (B = '"&B3&"' OR C = '"&B4&"') AND D = '"&B5&"') OR (where B = '"&B3&"' AND (C = '"&B4&"' OR D = '"&B5&"') ) OR (where C = '"&B4&"' AND (B = '"&B3&"' OR D = '"&B5&"') ")
The AND and OR functions work separately in their own query functions, but when I combine them together I get the following error message:
Error
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "(" "( "" at line 1, column 11. Was expecting one of: "where" ... "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ...
Any help? Thanks!
you can use where only once in one QUERY. try:
=QUERY(Updates!A1:E,
"where 9=9 "&
IF(B3="",," and B = '"&B3&"'")&
IF(B4="",," and C = '"&B4&"'")&
IF(B5="",," and D = '"&B5&"'"), )
I have a Google Sheets document that looks like this:
A B C D
1
2 X X 3
3 Z Y 2
4 W Z 6
5
How can I do so that if the element in column A is one of the elements of column B, its corresponding value in column C is added to column D? In this case, column D must have this values:
D2 = 3, because X is in column B
D3 = 2, because Z is in column B
D4 = 0, because W is not in column B
Many thanks in advane!
use:
=INDEX(IF(A2:A="",,IFNA(VLOOKUP(B2:B,
FILTER(B2:C, COUNTIF(B2:B, A2:A)), 2, 0))*1))
You could use:
=INDEX(IF(A2:A="",,COUNTIF(B2:B,A2:A)*C2:C),,)
I have this kind of table on a tab (called "Log"):
A B C D E F G H
a1 b1 c1 d1 5 f1 g1 h1
a2 b1 c2 d1 3 f2 g2
a3 b2 c1 d2 4 f3 g3 h2
a4 b1 d1 5 f4 g4
a5 b2 c3 d1 3 f5 g5 h3
On another tab (called "Watch") of the same file I have a dropdwon menu with all the "D"s.
I'm trying, on the "Watch" tab, with the QUERY function to visualize C,E,G and H. C,E and H have to always be visualized while I need G only if "E"s are between "1" and "3".
The closest I got was this:
=QUERY(Log!B:H, "SELECT C,E,H,G WHERE D='"&B1&"' and H is not null and E<=3")
but it shows only where "E"s are <=3 ignoring the choice from the dropdown menu (WHERE D='"&B1&"')
try:
=QUERY(Log!B:H,
"select C,E,H,G
where lower(D) = '"&TRIM(LOWER(B1))&"'
and H is not null
and E<=3", 0)
Try with this:
=filter({Log!C1:C5,Log!E1:E5,Log!H1:H5,arrayformula(if((Log!H1:H5="")*(Log!E1:E5<=3),Log!G1:G5,""))}, Log!D1:D5="d1")
or
=filter({Log!C1:C5,Log!E1:E5,Log!H1:H5,arrayformula(if((Log!H1:H5="")*(Log!E1:E5<=3),Log!G1:G5,""))}, Log!D1:D5 = B1)
or
=filter({Log!C1:C5,Log!E1:E5, Log!H1:H5,if((Log!H1:H5="")*(Log!E1:E5<=3)=1,Log!G1:G5,"")},Log!D1:D5="d1")
The Result:
c1 5 h1
c2 3 g2
5
c3 3 h3
How to get values from another sheet if another cell empty. I'm trying to get values from sheet1 column B if in sheet1 column H empty.
I mean if Sheet1 column B2 to B4 have values and in Column H on the same sheet, if H2 and H3 have text only B4 value print.
Sheet1 Image
Sheet2 Image
Here is what I try to do that not work
=query(Sheet1!B2:B, "Select Sheet1!b where Sheet1!H <> ''")
try:
=FILTER(Sheet1!B2:B, Sheet1!B2:B<>"", Sheet1!C2:C="")
or:
=QUERY(Sheet1!B2:C, "select B where B is not null and C is null", 0)
or:
=QUERY(Sheet1!B2:C, "select B where B !='' and C =''", 0)
I am working with the following C statement, and trying to convert it over to Swift:
if (c1 & c2 & c3 & c4 & c5 & 0xf000)
I am not very familiar with C, so I'm not exactly sure what the if statement is checking, but c1, c2, c3, c4, & c5 are integers, and I know that "&" is a bitwise operator. How could I implement this same statement in Swift?
In C (if I recall correctly), if the result of the paranthesised expression c1 & c2 & ... evaluates to a non-zero value, then that is considered "true".
In Swift, type safety being important, the result of bitwise operations are not automatically cast to a truth value (the Bool type), so you'd need to something like
if c1 & c2 != 0 {
// do this
}
You're probably looking for something like below:
let c1: UInt16 = 0x110F
let c2: UInt16 = 0x1101
let c3: UInt16 = 0x1401
let c4: UInt16 = 0x0001
let c5: UInt16 = 0x0A01
if c1 & c2 & c3 & c4 & c5 & 0xF000 != 0 {
println("Do Something, because some bits lined up!")
}
Swift bitwise operators are described here: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html
Bitwise operators are the same in both C and Swift. In C that statement is checking to see if there is at least one bit position that each variable (and the literal) have in common where there is a '1' value. Those common ‘1’ positions are dropped into the new value. 11001 & 10101 would drop into 10001, for instance.
The resultant in both languages is (essentially) an integer. The real difference between C and Swift here is that in C any value that is not ‘0’ can be interpreted as the boolean true. Your C code snippet is doing just that; interpreting a non-zero value as true. Swift, on the other hand differentiates between an integer and a boolean, and requires specificity. That is why in my Swift snippet you have to specifically check for a value that is non-zero.
BTW, you could change your c snippet to what I have below and have the logical equivalent, as well as match the Swift snippet.
if ( (c1 & c2 & c3 & c4 & c5 & 0xf000) != 0)
Hope that was at least a little helpful.