Why use a leading AND() in a formula?

Russ1

New Member
Joined
Jan 16, 2025
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I was looking at this old post where a guy said to use a formula that started with AND() and only had 1 operator. From my testing, AND() with only operator doesn't seem to do anything other than give the same output of whatever boolean logic is inside it. (Put TRUE in it, returns TRUE. Put FALSE in it, returns FALSE.)


I'm just wondering what the point of doing this is? I would have asked the guy but he apparently stopped posting in 2022 so he must be gone.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
There doesn't seem to be an "edit" button here so I will just say, maybe it has to do with just compressing the output of the formula to be only one value instead of many values in an array.
 
Upvote 0
Hi, welcome to the forum! In your modern version of Excel you'll see that if you put the formula into a blank cell without the AND() function, that it returns an array of TRUE/FALSE values for each character in the cell its referencing. The AND() function test all the values in that array and only returns TRUE if they are all TRUE.

There's probably better ways to do it now with the newer functions.

Book1
ABC
1ab/d\fsTRUEFALSE
2TRUE
3FALSE
4TRUE
5FALSE
6TRUE
7TRUE
Sheet1
Cell Formulas
RangeFormula
B1:B7B1=ISERROR(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"\/:%'*?<>|""."))
C1C1=AND(B1#)
Dynamic array formulas.
 
Upvote 1
Hi, welcome to the forum! In your modern version of Excel you'll see that if you put the formula into a blank cell without the AND() function, that it returns an array of TRUE/FALSE values for each character in the cell its referencing. The AND() function test all the values in that array and only returns TRUE if they are all TRUE.

There's probably better ways to do it now with the newer functions.

Book1
ABC
1ab/d\fsTRUEFALSE
2TRUE
3FALSE
4TRUE
5FALSE
6TRUE
7TRUE
Sheet1
Cell Formulas
RangeFormula
B1:B7B1=ISERROR(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"\/:%'*?<>|""."))
C1C1=AND(B1#)
Dynamic array formulas.

Is the formula I referenced basically a For loop that starts at i=1 and goes to i=whatever length of the thing? That is clever, I hadn't thought to do that.
 
Upvote 0
a For loop that starts at i=1 and goes to i=whatever length of the thing?
Hi, I'm not sure I'd use that exact analogy, but I guess it's pretty close (y)

This part ROW(INDIRECT("1:"&LEN(A1))),1) returns a array of numbers starting at 1 and incrementing to the length of whatever is in the cell the formula is referencing. This is fed into the start_num parameter of the MID() function.
 
Upvote 0

Forum statistics

Threads
1,225,757
Messages
6,186,850
Members
453,379
Latest member
gabriellegonzalez

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top