#1
|
|||
|
|||
AND function be used as criteria in DB functions?
I read some docs that say this: AND and OR functions can be used as criteria in DB functions. It gives this example:
=AND(E4>F9,D7<A5,M3>G1,B1=“FY 2010”) with the final argument being the result that is displayed (I presume meaning if that above is listed in the criteria, it would resulst in FY 2010 being the criteria). But I can't seem to find anything that indicates that AND would work like that, or make anything work with it. Any comments/thoughts? |
#2
|
||||
|
||||
This statement is perfectly valid and will return FALSE or TRUE. What problem do you have?
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#3
|
|||
|
|||
Quote:
The problem that I have is that the criteria in all the examples in the documentation (not using any AND statements in examples), expects a criteria statement, such as B1=FY 2010, not a True or a False value. It is referring to DB functions. Below is the definition of what Criteria is from the Excel Help: Quote:
|
#4
|
||||
|
||||
The helpfile that I have says that you can create AND and OR logic in your criteria by correctly laying out (horizontal and vertical) the criteria in a range.
For example, the helpfile says that to create this logic: Boolean logic: (Salesperson = "Davolio" OR Salesperson = "Buchanan") you have to lay out the Salespersons as a list in the same column (there's a picture demonstrating it). If your source document is the helpfile then I think you've misunderstood "AND" and "OR" boolean logic to mean the AND() and OR() worksheet functions. If your document is something else then point us to it? |
#5
|
|||
|
|||
Quote:
I can't specifically point you to the document, as it is printed, and copyrighted. But I think that the document, on this particular topic, is written poorly. It lists it exactly as I wrote in the initial post. And it has the title on the page that it can be used that way in DB functions. Based on being written that way, and based on the fact that earlier in the document they discussed the AND and OR functions, also exampled the same way, I presumed that was what they meant. I appreciate the feedback. I think the final thought is that they meant as you described, which then does make sense. |
#6
|
||||
|
||||
Oh, but you can use formulas which return TRUE or FALSE as criteria too. For calculated criteria like this, you must leave the column header blank. For example, in the helpfile:
Quote:
=AND(E4>F9,D7<A5,M3>G1,B1=“FY 2010”) It should return TRUE if all 3 criteria are met or FALSE if they aren't. When you use it in your criteria range, provided you have followed the rules in the helpfile, it should act as a filter accordingly. |
#7
|
|||
|
|||
Quote:
Ok. I may be wrong, but it seems to me that the only case where you would use a criteria that evaluates to True or False is in a situation where you would want to return either All or None of the DB that is being referenced. Would that be right? It seems to me that is all that could happen when using True or False as a criteria. |
#8
|
||||
|
||||
No, the criteria in your formula is applied to each row in the database. So you can use it to apply criteria across a row in the database which would be difficult or impossible to do by laying out the criteria how I mentioned earlier.
I've attached an example. In it I want to get a sum but only where the name begins with a capital "C". The criteria I'm using is: =EXACT(LEFT(B3,1),"C") So the LEFT() function gets the first letter and EXACT() returns TRUE or FALSE depending on if the first letter is a capital "C". Does that make sense? |
#9
|
|||
|
|||
Quote:
Hi, yes, that all makes sense, and I follow. I think where the confusion is, is that I was interpreting the statement of returning True or False literally, ie, useing the value True as THE criteria. Not the answer to the criteria. I'm in synch. I appreciate your input. |
#10
|
|||
|
|||
Quote:
My thought is that the entire example is incorrect, and that the third argument in the AND would be criteria, not results. |
#11
|
||||
|
||||
Quote:
In this formula: =AND(E4>F9,D7<A5,M3>G1,B1="FY 2010") All of the items inside the AND() are criteria. E4>F9 is criteria1 - a comparison which returns True or False D7<A5 is criteria2 - a comparison which returns True of False M4>G1 is criteria3 - a comparison which returns True or False B1="FY 2010" is criteria4 - a comparison which returns True or False Then =AND(criteria1 , criteria2, criteria3, criteria4) returns True if all four criteria are True, otherwise it returns False. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Acos, Cos and Sin functions in DAX PowerPivot | eramzan | Excel | 0 | 03-01-2012 11:32 AM |
Using IF and Vlookup functions | cpladson | Excel | 3 | 12-14-2011 11:57 PM |
Assign functions to F1, etc. | ibclare | Office | 4 | 06-02-2011 03:22 PM |
** Using Functions | djreyrey | Excel Programming | 10 | 02-08-2011 04:18 PM |
Automated Functions?? | nickypatterson | Outlook | 0 | 08-27-2009 01:50 PM |