Google Sheet - how to check if value is in diffrent column? - google-sheets

I have 2 columns A and B in google sheet and I would like to make 3rd column C in which I will have only values that are in column B and are NOT in column A.

Do a countifs of A given value of B
Anything that comes back as 0 is good to go into C.
Filter or sort your range
just copy paste
value into C.

Related

Google sheets - format a column by comparing values with another

I have a google sheet with 2 columns, one has unique values the other one a list of several values;
I need to know if all the values of my first column are somewhere in the second one
Thank you
Column A
Column B
A
A, B, C
B
D, E, F
D
G,R, Y
I tried with =COUNTIF(FILTER(B:B,A:A=ROW(A:A)),C:C) > 0
But I can't manage to write this formulae correctly
I expected the column A to be green if the value exists in column B
With REGEXMATCH you'll be able to find the value in the next column. Try with:
=REGEXMATCH(B1,A1)*(A1<>"")
OPTION 2
Above was to checking if it appears in the corresponding row. To check the entire column with more than one value per row:
=REGEXMATCH(TEXTJOIN(",",1,B:B),A1)*(A1<>"")

Google Sheets - get value from above

I'm trying to work out a function in a Google Sheets cells to look at a column then search current row and "above" the current row to find a non number value (text).
I have data that in two columns B (item code or category) & C (item description).
I need another column to contain the categories for each item - column D. I'm looking for a formula for this column, ideally an Arrayformula as the data can change, there can be multiple items per category, some might be only 1 item, some might be 100 items per category. The arrayformula in column D will get the category from column B if it is not a number.
B column - categories and item codes, C column - item descriptions, target is D column a copy of the categories from column B.
I've tried this numerous times and usually give up, do it manually but it becomes teadious quickly. Looking forward to any help that might come from this! thanks.
In D2 try
=Arrayformula(if(isnumber(B2:B), vlookup(row(B2:B), filter({row(B2:B) , B2:B}, istext(B2:B)), 2), B2:B))
and see if that works?
Try in D1
={"Category";ArrayFormula(lookup(row(B2:B),row(B2:B)/if(isnumber(B2:B),0,1),B2:B))}

Is it possible to use two cells of criteria to return a value from a third column?

I have an Google sheets file with two sheets. I'm trying to reference one sheet's text based on two cells of criteria using a formula in the other sheet. I have one sheet that looks similar to this -
And another that looks like this -
I would like to put a formula on the second sheet that basically says - look on the first sheet for the values in columns A and B and return me the value in column C. The tricky part is - the values in the second sheet may be inverted or there may be an instance where only one value is present, like in row 1 in the first sheet. Also the formula should only fill in a value if both columns match. All text combinations in both sheets are unique.
Is it possible to do this with text? Thank you for your help!
Try the following
=ArrayFormula((IFERROR(VLOOKUP(R2:R&S2:S,{O2:O&P2:P,Q2:Q},2,0))&
IFERROR(IF((R2:R<>"")*(S2:S<>""),VLOOKUP(R2:R&S2:S,{P2:P&O2:O,Q2:Q},2,0),""))))
(Do adjust locale and ranges according to your needs)
Functions used:
ArrayFormula
IFERROR
IF
VLOOKUP
If you can use two keys concated in the lookup table as a virtual key (i.e. make a key like "CAT|DOG"), then you can use that to look in the secondary table.
If you can't guarantee the sort order of the two keys in the secondary table, you can use the following technique to "sort" the two keys so you can make a single lookup key that's always in one stable order.
Sample Table
A
B
C
D
E
SortedKey
Cat
Dog
TRUE
Cat
Dog
CatDog
Dog
Cat
FALSE
Cat
Dog
CatDog
Formulas
Sample formulas for row #1.
For column C, use formula: =A1<B1
For column D, use formula: =IF(C1=TRUE, A1, B1)
For column E, use formula: =IF(C1=TRUE, B1, A1)
For SortedKey, use formula: =concat(D1, E1)

Check if there are higher values in 2 columns (C&D) on other sheet based on cell value in column B & autopopulate result

Link to Google Sheet Sample
In column E on sheet 'Calc', I want to check if there's a person in sheet 'Data' who has the same A value, but a higher value on B and C. Eventually I want to Return 'No' if not, return 'yes' if yes. If there's a person with the same A value who has a higher value on B but not on C (or vice versa) return 'maybe' with the name of the person(s). Autopopulate E with the returned value.
The values in columns B, C and D in 'Calc' are dynamic and will change based on other calculations. The B, C and D values in 'Data' are static. The length of both columns can differ.
Some examples:
Name 1 in sheet 'Calc' has the values of A89, B70, C70.
Person A in sheet 'Data' has the values of A89, B71, C75. No-one else has A89 and higher values on both B or C.
Return 'Yes'.
Name 1 in sheet 'Calc' has the values of A89, B70, C70.
Person A in sheet 'Data' has the values of A89, B60, C55. No-one else has A89 and higher values on both B or C.
Return 'No'.
Name 1 in sheet 'Calc' has the values of A89, B70, C70.
Person A in sheet 'Data' has the values of A89, B71, C55. No-one else has A89 and higher values on both B or C.
Return 'Maybe: Person A'.
Name 1 in sheet 'Calc' has the values of A89, B70, C70.
Person A in sheet 'Data' has the values of A89, B71, C55. Person B in sheet 'Data' has the values of A89, B55, C71. Person A has the highest value on B compared to the people in sheet 'Data' with A89 but a C lower than that of Name 1 in sheet 'Calc'. Person B has the highest value on C compared to the people in sheet 'Data' with A89 but a B lower than the of Name 1 in sheet 'Calc'.
Return 'Maybe: Person A, Person B'.
I've tried to make a start by just getting the highest values in sheet 'Calc' by combining =ARRAYFORMULA with MAX, but I get either a 'different number' array error or everything is just compared to B3.
Error:
=ARRAYFORMULA(IF(ISBLANK($A3:$A);;$B3&":"&MAX((Data!$B3:$B=$B3)*Data!$C3:$C)&":"&MAX((Data!$B3:$B=$B3)*Data!$D3:$D)))
Only calculated with B3:
=ARRAYFORMULA(IF(ISBLANK($A3:$A);;$B3&":"&MAX((Data!$B3:$B=$B3)*Data!$C3:$C)&":"&MAX((Data!$B3:$B=$B3)*Data!$D3:$D)))
Edit: I've removed the open-ended ranges which at least removed the error I got, but it still doesn't return the desired numbers (it returns either zero or the highest numbers belonging to the first entry, B3). I've updated the sheet accordingly.
=ARRAYFORMULA(IF(ISBLANK($A3:$A999);;$B$3:$B$999&":"&MAX((Data!$B3:$B999=$B$3:$B$999)*Data!$C3:$C999)&":"&MAX((Data!$B3:$B999=$B$3:$B$999)*Data!$D3:$D999)))
Your issue is that your two tabs are of different size AND you have open ranges.
Your Calc tab is 1002 rows, while Data is 2001 rows.
You have 2 alternatives
Solution 1
Add just one more row in your Data tab or delete one from your Calc tab.
Solution 2
Use closed ranges as in
=ARRAYFORMULA(IF(ISBLANK($A3:$A888);;$B3:$B888&":"&MAX((Data!$B3:$B888=$B3:$B888)*Data!$C3:$C888)&":"&MAX((Data!$B3:$B888=$B3:$B888)*Data!$D3:$D888)))
In either case, make sure your ranges have the same amount of rows.
I've not found a way to autopopulate it yet, but this solution works for me because I can just copy it to a lot of cells by combining an IF-statement with a ISBLANK() formula.
Basically I've used this, wrapped in a couple of if-statements, changed the returned data according to my needs, and built the code up from there. It returns the desired cell-value from the person with the highest B-value and who's A-value corresponds with the one on the CALC sheet.
INDEX(
Data!$C:$C
;
MATCH(
MAXIFS(
Data!$C$3:$C$100
;
Data!$B$3:$B$100
;
$B3
)
;
Data!$C:$C
;
0
)
)
The code in column M in the sample-sheet is the code that I've started using. It's not pretty (at all) and could probably be a lot more efficient, but it works and this already took a lot of googling, tries and patience, so I'm a bit at the limit of my google-formula knowledge, haha.
This is the formula I've implemented in this sheet for conditional formatting, should someone need something like it. It picks the maximum value of a column based on a criteria in another:
=$E3=MAXIFS($E$3:$E$100;$M$3:$M$100;"Yes")

Googlesheet merge 2 cells in next column based on their content

I have a Googlesheet with Column A= ID like B-124992 or D-133739 and several different ID's as well, Column B= Title description. I want to Merge only the "B-" and "D-" -like ID's with their respective Title description. I'm using ArrayFormula in column C like:
= ArrayFormula(IF(ISNUMBER(FIND({"B-","D-"};'BacklogData'!A2));A2&" - "&B2;""))
The result is merging as expected but the output is distributed in column C (shows all "B-" merge results) and column D ((shows all "D-" merge results).
How can I get the results all in column C?
In C2 try:
=ArrayFormula(if(len(B2:B); if(regexmatch(A2:A; "(B-|D-)"); A2:A&"-"&B2:B;);))
This will reference the colA and output the concatenation of col A and colB if col A starts with either B- or D.
NOTE: you will have to erase all formulas you currently have in col C.
Hope that helps ?
EDIT: not sure if you are referencing another sheet, but in that case you will have to add in the sheet name, like you did in the example you gave.
I don't think you need an array formula for this - all you need is an OR condition in a standard formula:
=IF(OR(LEFT(A2,2)="B-",LEFT(A2,2)="D-"),A2&" - "&B2,"")
and copy as far down column C as you need. Since this is not an array, it will only return one result per cell which is what you want.

Resources