简体   繁体   中英

Excel Array Formula Error

I am coming to seek guidance with another question with Excel Array Formulas.

I am using Excel 2003 and trying to understand a new spreadsheet with the following type of formula :

{=IF($B$6,SUM(($C$6:$AM$6=1)*1),)}

I have tried using the Excel formula audit tool to understand the formula but it crashes when I run it on these type of array formula.

As of now I am thinking that the formula does this :

B6 has a number = True / False
If True do SUM of (C6:AM6=1) and multiply by 1
If False do nothing

However, I am not 100% of the second statement. Does it say SUM the number of times 1 is present in C6:M6 then multiply by 1? If so why multiply by 1. My only guess on the latter is that the (C6:M6=1) returns a True or False value and the *1 converts it to 0 or 1. Then if this is correct, what is the purpose of the sum function?

Thanks for any guidance.

You are correct.

($C$6:$AM$6=1) returns an array of TRUE/FALSE values, which SUM would ignore.

Multiplying by 1 creates an array of 1/0 values, which are then added by SUM to create a count of the number of cells in the range that equal 1.

COUNTIF would be simpler as mentioned previously.

I think you do not need an array function. Try this non-array formula:

=IF($B$6,SUMIF($C$6:$AM$6,1,$C$6:$AM$6),"Do Nothing")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM