I have text in B1:B15, if text in B17 = anything from B1:B15 return in C17 true otherwise false - excel-2010

I'm trying to write a string that can cover off all text in B1:B15 but get stuck when comes to adding beyond the first part which I can get to work.
I have this so far =IF((B17=B1),"North")
I then want to continue so covers off B1:B8 as North and B9:B15 as South based on selection made
Example

Your question title says you want to see 'True' or 'False' in C17 depending on whether or not the value in B17 is in the list B1:B15. Try this in C17:
=NOT(ISNA(VLOOKUP(B17,B1:B15,1,FALSE)))
If instead of just getting true/false you want to return the value in column C depending on which value was matched in column B then you would use:
=VLOOKUP(B17,B1:C15,2,FALSE)

I don't quite understand what you're asking because your example image has nothing in B17.I assume you're writing your equation in C1?
If I'm following what you're asking, what you actually probably want to do is, in C1:
=IFERROR(VLOOKUP(B17,$B$1:$C$15,2,0),"Not found")
Then fill that equation down as far as you need to go in column C. The iferror means if the vlookup fails to find something, it'll display that message, which you can make whatever.

I will follow your logic
=IF(COUNTIF(B1:B16,A17)>0,"True","false")
"If the number of coincidences of A17 in the range B1:B16 is bigger than 1 then 'True', else 'false'"

Related

I need ARRAYFORMULA() to use conditions in another row to decide what to calculate

Here is my formula in G5
=ARRAYFORMULA(IF(AND(J5:J17=true,H5:H17=false),E5:E17*F5:F17*1.075,IF(AND(J5:J17=true,H5:H17=TRUE),0,IF(and(J5:J17=false,H5:H17=false),E5:E17*F5:F17,IF(and(J5:J17=false,H5:H17=true),0)))))
This works if Cols H,I, and J are all false, however once I start setting anything in H,I,or J to true, the formula stops working.
Thanks for any help, Im really stumped on this one.
I think you can simplify your formula all the way down to:
=arrayformula(E5:E17*F5:F17*not(H5:H17)*if(J5:J17,1.075,1))
A few pointers:
What you were trying to achieve boils down to: 'on each row, give me the value of the cell in colE * the value of the cell in colF, multiplied by 1.075 if the cell in colJ is ticked, unless the cell in colH is ticked, in which case give me 0.
You don't need to evaluate tickboxes against TRUE/FALSE as they contain a TRUE/FALSE themselves (so the =TRUEs & =FALSEs in your formula are redundant)
AND/OR in arrays don't work the way you might initially want them to as they are aggregating functions (i.e. they accept arrays as input by design) and wrapping them in ARRAYFORMULA to try to make them evaluate the input arrays row-by-row or column-by-column doesn't work. Historically the answer to this problem has been to use Boolean algebra (where AND is * & OR is +, FALSE=0 and TRUE<>0) as I've done here which normally makes for the most compact representation, but more recently it's also been possible to use MAP to process arrays element-by-element (in which case AND/OR can still be used) as per one of the other answers
You only really need to use IF statements if you want to return values other than TRUE/FALSE (1/0) as a result of a logical evaluation (like your colJ where you want TRUE=1.075 & FALSE=1); otherwise you can omit them and just use Booleans.
use:
=ARRAYFORMULA(IF((J5:J17=true)*(H5:H17=false), E5:E17*F5:F17*1.075,
IF((J5:J17=true)*(H5:H17=TRUE), 0,
IF((J5:J17=false)*(H5:H17=false), E5:E17*F5:F17,
IF((J5:J17=false)*(H5:H17=true), 0)))))
You can try to do this with MAP:
=MAP(J5:J17,H5:H17,E5:E17,F5:F17,LAMBDA(j,h,e,f,
IF(AND(j=true,h=false),e*f*1.075,IF(AND(j=true,h=TRUE),0,IF(and(j=false,h=false),e*f,IF(and(j=false,h=true),0))))))

Inexperienced programmer requesting assistance in finding the error in a Google Sheets formula

Google Sheets tells me that there is a formula parse error for the following and I can't seem to find my mistake.
I have little programming experience but I want to make a fairly simple invoice form for the business I work in. I've written the following formula in a line total:
=IF(B28="Rabais", if(REGEXMATCH(I28,%),((sum(J19:J27)*I28)*-1), (I28*-1)), if(H28=0, I28, (H28*I28)))
I need that line total to change according to the following rules:
If the value "Rabais" is selected in the dropdown in cell B28, and if cell I28 contains a percentage, then the formula returns the negative of that percentage of the sum of the values of cells J19 to J27.
If the first criteria is true and the value of I28 isn't a percentage, then the formula returns the negative of the value of I28.
If the first criteria is false, then the formula checks if H28 is empty, and if so it returns the value of I28
If both If statements return false, then the formula returns the value of H28 times the value of I28.
I thought I had written everything properly, but obviously, I made a mistake somewhere and I can't seem to find it so I would appreciate a fresh set of eyes pointing it out.
this is how you do it:
=IF(B28="Rabais",
IF(REGEXMATCH(TO_TEXT(I28), "%"), (SUM(J19:J27)*I28)*-1, I28*-1),
IF(H28=0, I28, H28*I28))

Check if data that satisfies multiple criteria exists in both sheet 1 and sheet 2

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.

Google Sheets, need to edit a column based on two columns on a second sheet

Good morning!
I've been searching high and low for how to do this, and while I feel like I get close I can't get anything more than 'invalid formula' from the conditional formatting in google sheets. So here's what I'm trying to do;
Column C on sheet 1 (Working List) needs to have a red background if the following conditions are met;
Column 'P' on sheet 2 (Complete) has the 'Address Changed' option in the drop down box (its the first one on the drop down, I've been struggling to figure out if it needs to be a '0' given its position in the list or if its 'Address Changed')
Column 'C' on sheet 2 has the same account numbers in Column 'C' on sheet 1.
I can set it up to find duplicate accounts, but I can't seem to figure out how to get the first rule for the drop down box to work. Advice?
Attempts thus far, none of them worked, all were tried separately and not in conjunction with each other. Google just says 'invalid formula' and won't save it or do anything with it.
=and(EQ(Complete!$O, "Address Changed"), EQ('Working List'!$C, Complete!$C))
=match($C2, indirect("Complete!$C:$C"), 0)
=if(EQ, indirect("Complete!$O, "Address Changed""), EQ('Working List'!$C, "Completed!$C"))
=and(indirect("Complete!$O:$O,$O="Address Changed""))
so I've tried to figure out a better way to get it working, and this is what I think might be closer to the answer.
=and(if($O:$O,indirect("Complete!$O:$O),0)),[match($C2,indirect("Complete!$C:$C"),0)]
***Friend helped me solve this. The following worked for what I needed....
=index(indirect("Sheet2!O:O"), match(C1, indirect("Sheet2!C:C"), 0)) = "Address Changed"
Take a look at this sheet with some foo data I built based on your sheet.
https://docs.google.com/spreadsheets/d/1RcM5WX3KWgWq-WWuPgyF-PZe3RP99qWF-IRpSr35Zik/edit?usp=sharing
I used some helper column, as you see.
if sheet2!P1 is changed to "Address Changed" K1 will have value of 1. This is a simple IF function.
if sheet2!C = sheet1!C, L will change to 1. This is another simple ARRAYFORMULA(IF())
Finally, column C will be formatted with the data from K1 and L by this formula
: =AND(L2=1, $K$2=1)
You can then hide the helper column / cell.
If you don't want to use helper column, look at the formula in column D :
=AND(INDIRECT("Sheet2!C2:C") = C2:C, INDIRECT("Sheet2!P1")="Address Changed")
This will serve your purpose.
You cannot refer to another sheet directly in conditional format formula, hence if you don't want to use helper column, you will have to use INDIRECT. This is also the reason why your formula failed in the first place.
I personally wouldn't recommend you to use INDIRECT though...

multiple if conditions nested with a concatenate - Google Sheets

I have a formula as follows which I'm using for a scheduling system within Google Sheets:
=IF(B2="","",(CONCATENATE($B$1&" "&B2&CHAR(10)&$C$1&" "&C2&CHAR(10)&$D$1&" "&D2&CHAR(10)&$E$1&" " &E2&CHAR(10)&$F$1&" " &F2&CHAR(10)&$G$1&" " &G2)))
currently my formula works b2 has a value inside it which is great, what I want however, is for the formula only to show if one value is inside either.
B2, C2, D2, E2, F2 or G2.
so if c2 has a value I want the formula to parse.
I've tried
=IF(B2,C2,E2) etc with no luck.
I've also tried:
=IF(OR(B2="",C2="") which parsed the formula but kept it visible even with no data.
Reason for this is that I pull these fields into a master schedule and I only want it to show when one of the fields is populated, if that makes sense? otherwise the schedule will look far to busy.
https://docs.google.com/spreadsheets/d/1KE3VOI43M4-QlWB0EZldCqR73d3RHDnRnUNlv1MqLMo/edit?usp=sharing
Document for you guys.
Cheers!
If your goal is to show a formula when any of a given range of cells is not empty (and display nothing if they are all empty), you can simplify your condition check by first joining all ranges, and then comparing to the empty string:
=IF(JOIN("", B2:G2)="", "", "Your Formula")
You need to use AND() instead of OR().
=IF(AND(B2="", C2=""), "", "Formula")
Also, although this makes the formulas longer, I do prefer to use a combination of IFERROR(), ISBLANK(), and NA(). I prefer this because a blank cell is not the same as one with an empty string in it. So my preferred way of writing the above would actually be:
=IFERROR(IF(AND(ISBLANK(B2), ISBLANK(C2)), NA(), "Formula"))
just another solution I came across which I thought was much better than my own and made the data above a little tidier.
=IF(A2<>"",CONCATENATE(IF(B2<>"",$B$1&": "&B2&CHAR(10),),
IF(C2<>"",$C$1&": "&C2&IF(OR(D2<>"",E2<>"",F2<>"",G2<>""),CHAR(10),),),
Essentially this will populate only whats selected instead of populating all the fields in headers and then populating the scheduled work stream.

Resources