ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Microsoft Excel Formulas: Logical Formulas: AND

Updated on July 23, 2012
Venn Diagram showing A ^ B
Venn Diagram showing A ^ B | Source

Definition of AND (logical conjunction)

In mathematics and logic, a two-place (or multiple place) logical operator or logical conjunction results in TRUE if both (or all) of the operands are TRUE; otherwise it will result in FALSE. Writing this down logically taking operand one as A and operand two as B:

A ^ B returns TRUE if both A and B are TRUE, otherwise A ^ B returns FALSE.

To break this down in real terms, take an example of going to a concert. If Johnny and Peter can both afford to go to the concert then they will by tickets; if one of them cannot afford to go to the concert then they will not buy tickets.

Using an AND in this case and creating a truth table of A ^ B for you get the following (where A represents whether Johnny can afford the concert and B represents whether Peter can afford the concert):

Truth table for A ^ B
Truth table for A ^ B | Source

So using the table:

(A) Johnny can afford the concert (TRUE)

(B) Peter can afford the concert (TRUE)

A ^ B = TRUE therefore they can go to buy the tickets.

Any other combination would result in a FALSE and therefore they would not buy tickets.

Quick overview of other logical functions in Microsoft Excel:


  • OR: returns a TRUE value if any of the conditions are TRUE. Syntax: OR(logical1, logical2, logical3, ….)
  • IF: performs a logical test on multiple logical arguments and provides a result based on a TRUE or a FALSE value. Syntax: IF(logical, True Result, False Result)
  • IFERROR: returns a value if a logical function evaluates to an error, otherwise returns the result of the logical function. Syntax: IFERROR(logical, logical_error)
  • FALSE: returns the value FALSE. Syntax: FALSE()
  • TRUE: returns the value TRUE. Syntax: TRUE()
  • NOT: reverses the logic of the argument. Syntax: NOT(logical)

Microsoft Excel AND Function

In Microsoft Excel, AND is a logical function that returns a TRUE value if all its arguments are true, otherwise it will return a FALSE value. It performs in exactly the same way as AND in logic and mathematics.

Syntax: AND(logical1, logical2, logical3, …) where logical1, logical2, logical3 are conditions that will return a TRUE or FALSE result.

Notes:

  • The AND function in Excel must have one condition and can have a maximum of 255 conditions (30 in Excel 2003 or prior).
  • Each condition must produce a logical value TRUE or FALSE (blank arguments or arguments containing text are ignored).
  • If there are no logical values the AND function will return the #VALUE error value.

When to use an Excel AND function:

There are many uses for the AND function within Microsoft Excel:

  • It can be used to test whether a number is within a certain range: =AND(number>=1, number<=6) will test whether the number is between 1 and 6 and return a TRUE value if the number meets the conditions.
  • It can test criteria such as Employee and Office: =AND(Employee=”Cook”, Office=”Grimsby”) will test to see if the Employee is “Cook” and his Office is “Grimsby” and will return a TRUE value if these conditions are both TRUE.
  • It can test criteria such as Employee and Sales: =AND(Employee=”Smith”, Sales>599) will test that the Employee is Smith and that her Sales are greater than 599 and will return a TRUE value if these conditions are both TRUE.
  • When used in conjunction with other functions such as IF and OR it becomes very powerful: =IF(AND(OR(Employee="Cook", Employee="Smith"),Sales>599),"Result 1","Result 2") will first take the logical OR function and evaluate it – so if the employee is either Cook or Smith this part of the function will return TRUE; it then will evaluate the second part of the function Sales>599 and if Sales are greater than 599 then this will return TRUE. The AND function evaluates these two conditions and if both are TRUE then it returns TRUE. The IF statement will return ‘Result 1’ if the AND function is TRUE and ‘Result 2’ if the AND function is FALSE. So if the employee is Cook or Smith AND their Sales are greater than 599 then the function returns ‘Result 1’, any other combination will return ‘Result 2’.

Examples of the AND function and the results.
Examples of the AND function and the results. | Source

Conclusion

The logical functions on Microsoft Excel allow for logical analysis on sets of data. The AND function tests conditions logically and allows for data to be filtered based on criteria. When used in conjunction with the other logical functions (OR, FALSE, TRUE, IFERROR and NOT) it becomes an essential tool for worksheet designers.

working

This website uses cookies

As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://corp.maven.io/privacy-policy

Show Details
Necessary
HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
LoginThis is necessary to sign in to the HubPages Service.
Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
AkismetThis is used to detect comment spam. (Privacy Policy)
HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
Features
Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
MavenThis supports the Maven widget and search functionality. (Privacy Policy)
Marketing
Google AdSenseThis is an ad network. (Privacy Policy)
Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
Index ExchangeThis is an ad network. (Privacy Policy)
SovrnThis is an ad network. (Privacy Policy)
Facebook AdsThis is an ad network. (Privacy Policy)
Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
AppNexusThis is an ad network. (Privacy Policy)
OpenxThis is an ad network. (Privacy Policy)
Rubicon ProjectThis is an ad network. (Privacy Policy)
TripleLiftThis is an ad network. (Privacy Policy)
Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
Statistics
Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
ClickscoThis is a data management platform studying reader behavior (Privacy Policy)