How does (or why don't) AND(...) work with/as an array formula function?

How does (or why don't) AND(...) work with/as an array formula function?

Note: Gnumeric and ZOHO Sheet works the same way so there could be a good reason for it.

Say we have two collums with a x and y patttern
x   x
x   y
y   x
y   y

Add the same pattern 3 times to get some data.
Lets say we would like to count the rows containing x in both columns.
I did expect this formula to work:
=SUM(AND($A1:$A12="x"; $B1:$B12="x")*1)
(Finish  with CTRL+SHIFT+ENTER to specify array function).
But it does not and returns 1 rather than 3.

A formla that works is
=SUM(IF($A1:$A12="x"; IF($B1:$B12="x";1;0);0))
This one returns 3 as expected, but it is a lot harder to read and debug (in my eyes).

My understanding of an array function is that the application loops through the function with an element from the specified array ranges in each iteration.

This is what I think goes on. In the case of the formula with the AND expression inside is expanded like this:
=SUM(AND($A1="x"; $A2="x"; $A3="x" ... ... $B10="x"; $B11="x"; $B12="x")*1)
This behavior can be proven by setting all cells to x. Then you get the result 1. But if we change the *1 with another column like this:
=SUM(AND($A1="x"; $A2="x"; $A3="x" ... ... $B10="x"; $B11="x"; $B12="x")*$C1:$C12)
Then you get the same as =SUM($C1:$C12) if all $A1:$B12 cells contain x and 0 if one is y.

In the case of formula containing IF(...) I guessed it to be expanded something like this (where test(arg, arg)=:IF(...)
=SUM(test($A1, $B1);test($A2,$B2); ...; ... ;test($A12, B12))

But if that is the case then wrapping the AND(...) with an IF(...) should work, but t does not..o(

OK, so to wrap it up. I guess I have to use the IF construct without the AND part.
But what is the rationale for AND not to work like I expected (the same way as IF expressions are expanded)?

Is there a better way to achieve what I want (compare content of several columns and act upon rows matching the specified criteria).

Best regards.





































    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.







                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts



                                                              • Sticky Posts

                                                              • What's new in Zoho Sheet: Simplify data entry and collaboration

                                                                Hello, Zoho Sheet community! Last year, our team was focused on research and development so we could deliver updates that enhance your spreadsheet experience. This year, we’re excited to deliver those enhancements—but we'll be rolling them out incrementally
                                                              • New Features: Repeat Last Action, Insert Cut/Copied Rows/Columns and Hyperlink

                                                                You might have noticed the constant updates to Zoho Sheet of late. Here are 3 more features that have been added to Zoho Sheet recently: F4 - Repeat Last Action Insert Cut/Copied Rows and Columns Insert Hyperlink Here is a screen cast demonstrating each of these features. Read further below to learn more about these new features. F4 - Repeat Last Action: You can now repeat the last action you made on your spreadsheet by using the keyboard shortcut, F4. It is quite handy and helps you get your work
                                                              • Introducing Forms in Zoho Sheet

                                                                We hereby bring you the power of ​forms in Zoho Sheet. ​Now, build and create your own customized forms using Zoho Sheet. Be it compiling a questionnaire or rolling out a survey, Zoho Sheet can do it all for you. Forms is an excellent feature that helps you collect information in the simplest of ways and having it in Zoho Sheet takes it a notch higher. Build Simple yet Powerful forms Building forms using Zoho Sheet is fairly simple. The exclusive 'Form' tab lets you create one quickly. Whether you
                                                              • Slicers are now available in Zoho Sheet—filter your data interactively

                                                                At Zoho Sheet, we diligently track user requests and feedback. In line with this, based on extensive user requests, we've integrated Slicers to pivot tables and are delighted to announce its release. Slicers are interactive visual filters that have add,
                                                              • Introducing Data Bars: Graphically represent changes in data within the cells

                                                                Conditional formatting has helped millions of spreadsheet users analyze and highlight their data more efficiently. In addition to the classic rules, color scales, and icon sets available in Zoho Sheet, you can now apply Data Bars, a convenient method


                                                              Manage your brands on social media



                                                                    Zoho TeamInbox Resources



                                                                        Zoho CRM Plus Resources

                                                                          Zoho Books Resources


                                                                            Zoho Subscriptions Resources

                                                                              Zoho Projects Resources


                                                                                Zoho Sprints Resources


                                                                                  Qntrl Resources


                                                                                    Zoho Creator Resources



                                                                                        Zoho CRM Resources

                                                                                        • CRM Community Learning Series

                                                                                          CRM Community Learning Series


                                                                                        • Kaizen

                                                                                          Kaizen

                                                                                        • Functions

                                                                                          Functions

                                                                                        • Meetups

                                                                                          Meetups

                                                                                        • Kbase

                                                                                          Kbase

                                                                                        • Resources

                                                                                          Resources

                                                                                        • Digest

                                                                                          Digest

                                                                                        • CRM Marketplace

                                                                                          CRM Marketplace

                                                                                        • MVP Corner

                                                                                          MVP Corner









                                                                                            Design. Discuss. Deliver.

                                                                                            Create visually engaging stories with Zoho Show.

                                                                                            Get Started Now


                                                                                              Zoho Show Resources

                                                                                                Zoho Writer

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方