CodexBloom - Programming Q&A Platform

Excel Array Formula Not Returning Correct Results for Nested IF Statements with Multiple Ranges

πŸ‘€ Views: 431 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-12
excel array-formula if-statement Excel

I'm writing unit tests and I'm performance testing and I've been banging my head against this for hours. I'm working with an scenario with an array formula in Excel that involves nested IF statements across multiple ranges. I want to compute a conditional sum based on criteria in two columns, but the results are inconsistent. For example, I am trying to sum values in column C if the corresponding values in column A are "Yes" and values in column B are greater than 100. My formula looks like this: ```excel =SUM(IF((A2:A100="Yes")*(B2:B100>100), C2:C100, 0)) ``` I hit Ctrl + Shift + Enter to confirm it as an array formula, but it seems to return 0 even when there are matching rows. I've checked the data types in columns A and B to ensure they are consistent, and I've verified that there are indeed values in C to sum. In some cases, I get the dreaded `#VALUE!` behavior when I try to expand the ranges beyond 100 rows, which I suspect is due to the size of the data being processed. I also tried breaking the formula down into simpler parts, and when I test the criteria individually: ```excel =SUM(IF(A2:A100="Yes", C2:C100, 0)) =SUM(IF(B2:B100>100, C2:C100, 0)) ``` Both work correctly on their own, but combining them brings me back to a `#VALUE!` or incorrect summation. I’m using Excel 365, and I wonder if there’s a limitation or a different approach I should consider for handling this situation efficiently. Any insights on how to resolve this or optimize the formula would be greatly appreciated! Cheers for any assistance! I'm working with Excel in a Docker container on Debian. Any advice would be much appreciated.