Does AND function work with text? - excel-formula

I'm trying to use AND function to evaluate if some criteria is met.
Cell G2=AMAZON_US,
cell R2 = FBA,
my formula goes like this
=AND(G2="AMAZON_US", R2="FBA"),
but the result I getting is False, should be true.
Any help will be appreciated
Thank you!!

Your AND formula is correct, I tried and it returned true to me. I am wondering if your cell values are correct, i.e., if there are white-spaces in the cell content, or, you are referring to the correct cell values. Just to rule out for white spaces, can you try the following formula to see what happens?
=AND(TRIM(G2)="AMAZON_US",TRIM(R2)="FBA")

You should use the EXACT feature:
=AND(EXACT(G2,"AMAZON_US"), EXACT(R2,"FBA"))
This will do the string comparison. This is a case sensitive comparison, so be careful.

Related

Excel: Find particular (text) value in range

I'm struggling with something I think should be easy, it seems to be a common problem, I've found another solution here on the website but it won't work here in my document.
I want to find the (exact) value into a range, and having a true or false result if this value was found.
I tried with the combination of the find, isnumber and sumproduct formula but the value is never found, if I use a nested if formula it's working.
I have a dutch version of Excel, that's why you see "onwaar / waar" but onwaar is "false" and waar is "true".
Also my formula is written in dutch, but I translated it through the Excel-Translator.de website, I'm not 100% sure if it's done correctly.
In cell F2 I have this formula:
=SUMPRODUCT(SUMIF(E2, $A$2:$A$11))>0
In cell G2 I have this formula:
=IF(E2=$A$2,TRUE,
IF(E2=$A$3,TRUE,
IF(E2=$A$4,TRUE,
IF(E2=$A$5,TRUE,
IF(E2=$A$6,TRUE,
IF(E2=$A$7,TRUE,
IF(E2=$A$8,TRUE,
IF(E2=$A$9,TRUE,
IF(E2=$A$10,TRUE,
IF(E2=$A$11,TRUE,FALSE))))))))))
Thanks for your help.
First use function =COUNTIF($E$2:$E$11,A2) to know if the search value column contains your value.
Then, use function =IF(F2>=1,"True","False") determine true or false.
Combined, yout get =IF((COUNTIF($E$2:$E$11,A2)),"True","False")
screenshot of working example

condition formatting based on formula's result

I have a cell (AP21) containing a formula, and I want that the AP22 become black if the AP21 return empty string.
I am using conditionnal formatting but I not able to do that, because when I am using a formula to check the value of AP21, it's always considered as not empty because it contains a formula and not a text.
What I need is to evaluate in my AP22 the result of the formula of the cell AP21 and not the formula itself.
Any clue about how to do that please ?
Here is what I have to help you to understand me more
I tried also what is suggested in comments still didn't work
As #BigBen said in comments, you want to compare to an empty string
=$AP21=""

Add ISBLANK validation before comparing values

Actually I am not much familiar with Excel formulas.
I am using dates from Column E and F to color cells
=+IF(AND(DATEVALUE(I1)>=DATEVALUE($E$2);DATEVALUE(I1)<=DATEVALUE($F$2));1;2)
This formula is working fine when there is value present for column E and F.
if there is no value present for E and F it results error value.
I know little bit about ISBLANK() function.
I want to add condition to check cell E2 and F2 are not blank before my existing formula. Can you please suggest the proper syntax?
Thanks
You need to wrap your current operations in a function that checks each cell. If either of them is blank, you probably want to return "", or else the IF will automatically return FALSE.
You could use a chain of ifs, but since ISBLANK returns a boolean we can instead use an OR.
OR(ISBLANK($E$2),ISBLANK($F$2))
will return TRUE if either of the two cells is blank, so you'll need to put your operations into the False option, giving us:
=IF(OR(ISBLANK($E$2),ISBLANK($F$2)),"",IF(AND(DATEVALUE(I1)>=DATEVALUE($E$2),DATEVALUE(I1)<=DATEVALUE($F$2)),1,2))
Although you seem to have strange syntax, probably down to language settings or something, so you may prefer this:
=+IF(OR(ISBLANK($E$2),ISBLANK($F$2));"";IF(AND(DATEVALUE(I1)>=DATEVALUE($E$2);DATEVALUE(I1)<=DATEVALUE($F$2));1;2))
Use this condition which will ensure that both are not blank:
IF(OR(ISBLANK($E$2),ISBLANK*($F$2), your operations, "")
Thanks to all for your suggestions and valuable time.
But after reading some office.com documentation I find a proper solution.
IFERROR is more suitable than ISBLANK for my problem
instead of checking for blank cells I directly apply DATEVALUE() on cell . so if there is a blank cell DATEVALUE() return error and IFERROR() condition set value 2.
=+IF(AND(DATEVALUE(G1)>=IFERROR(DATEVALUE($E$7),0),DATEVALUE(G1)<=IFERROR(DATEVALUE($F$7),0)),1,2)

Excel Nesting IF in SumIfs

Ok. So i'm looking to nest IF in my SUMIFS formulas. The only problem i'm having is when one of my referenced cells show FALSE, the formula no longer works. How do i get the formula to completely remove that Criteria from the SUMIFS formula and still work?
Codes i've used.
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE5=TRUE,SUMIFS(R:R,J:J,BD5),0)
I've even tried breaking the SUMIFS formula into multiple cells, and using IF and INDIRECT to create a working code. Just keeps popping up with #REF error.
Here's that code
=INDIRECT(CONCATENATE(BK1,IF(BE2=TRUE,BK2,""),IF(BE3=TRUE,BK3,""),IF(BE4=TRUE,BK4,""),IF(BE5=TRUE,BK5,""),BK6))
Here's the code that didn't work before the IF.
=INDIRECT(CONCATENATE(BK1,BK2,BK3,BK4,BK5,BK6))
Any help would be greatly appreciated.
Thank you
Mock Sheet
https://www.dropbox.com/s/tl64vbsalcqxqdm/CriteriaIFS.xlsx?dl=0
Try this formula:
=SUMIFS(BK1:BK6,BK1:BK6,">=0")
Please try this formula,
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4,J:J,BD5),SUMIFS(R:R,J:J,BD5))
Your formula
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
You are saying:
Sum from column R everything if match in J with BD5 and IF BE4 is TRUE THEN in I IF match with BD5. Well, the error is because, if BE4 is true is returning a string not a range. Instead you could use this:
=SUMIFS(R:R,INDIRECT(IF(BE4=TRUE,I:I)),INDIRECT(IF(BE4=TRUE,BD4)),J:J,BD5)
And it will be ok, until BE4 is FALSE. because the INDIRECT function return an #REF!... and will be a mess.
I'm not sure if I get the whole idea, but please tell me if you need an emprovement.
Edit #1
Reading your comments I think this could help:
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE4=TRUE,SUMIFS(R:R,J:J,BD5))
Try to post some dummie database (using text table format) to give you a better help... and remember to read this: How to ask because your question is to vague, and it was necesary to many comments and answers to "guess" what you really want.
Try this array formula:
=SUMIFS(N:N,IF($A$2,E:E,T:T),IF($A$2,$C$2,""),IF($A$3,F:F,T:T),IF($A$3,$C$3,""),IF($A$4,H:H,T:T),IF($A$4,$C$4,""),IF($A$5,I:I,T:T),IF($A$5,$C$5,""))
It is an array formula and must be confirmed with Ctrl-Shift-Enter.
This is based on your data sheet provided. You will need to change the references to your sheet. The column T reference should be a column that is empty.
I needed to do the same thing. The formula needed to look at a different column as Criteria_Range2 depending on product. I put an IF statement for both the Criteria_Range2, and for the Criteria2 because each column had slightly different information. Basically, it tells the formula use column C (in another worksheet) as the Criteria_Range2 if the product category is anything other than Ceilings. If it is Ceilings, it uses column A as Criteria_Range2. On my worksheet, Column A is a "helper column" that groups our Ceilings sub-products into Tile and Grid.
Hopefully this isn't too confusing, but it works for me and I didn't easily find anything else out there showing how to use IF statements in the Criteria Ranges in the SUMIFS. (I suggest ignoring the very ugly xlookup defining the sum_range.)
SUMIFS(XLOOKUP($AF$20&"COGS CM MTD",Fact_Sales!$E$6:$CS$6&Fact_Sales!$E$7:$CS$7,Fact_Sales!$E$8:$CS$928),Fact_Sales!$B$8:$B$928,'Report Draft'!$AE27,IF('Report Draft'!$AD27<>"CEILINGS",Fact_Sales!$C$8:$C$928,Fact_Sales!$A$8:$A$928),IF('Report Draft'!$AD27<>"CEILINGS",'Report Draft'!$AD27,'Report Draft'!$AF27))

vLookup Match different lookup array

Can someone please advise the correct method to use so that I can dynamically change the Lookup_Array in a Match condition.
The following formula works fine;
=VLOOKUP(F22,A26:O2000,MATCH(A9,A26:O26,0),FALSE)
However based on other criteria I would like the Lookup Array to be different, instead of being A26:026 it would be A34:O34.
From what I understand your question to be, you can use Indirect(). Assuming that cell A1 has A26:O26 (literally typed, in the cell). You can use this formula,
=VLOOKUP(F22,A26:O2000,MATCH(A9,INDIRECT(A1),0),FALSE)
Then, if you want to use another range instead of A26:O26, just replace what's in cell A1.
Thanks guys, i have worked it out for myself please see below if anyone else has the same problem
=IF(J5>=INDEX(TCT.xls!pArray,MATCH(O5,TCT.xls!pGroup,0),5),INDEX(TCT.xls!pArray,MATCH(O5,TCT.xls!pGroup,0),5),J5)
Thanks

Resources