# Run formula that checks multiple cells and outputs to one cell

I want to run a formula that checks each cell between say F2 and F8, and if they match the relative cell in column B, it adds those cells together, and outputs in cell F9.

Example expected result:

``````|B2 - 5 |  |F2 - 10|
|B3 - 6 |  |F3 - 6 |- Match
|B4 - 9 |  |F4 - 9 |- Match
|B5 - 12|  |F5 - 15|
|B6 - 2 |  |F6 - 2 |- Match
|B7 - 14|  |F7 - 14|- Match
|B8 - 1 |  |F8 - 7 |
|B9 -   |  |F9 - 31|- Output Cell
``````

Edit: I left the part out where I ask if this is even possible. Silly me. So yeah, is this sort of formula possible on Google Sheets, or am I better off trying something else?

• Welcome. Please remember that as per site guidelines when an answer addresses your question, you should accept it so others can benefit as well. Commented Jan 21, 2020 at 18:02

The formula you would use is:

``=ArrayFormula(SUM(IF(\$B2:\$B27=K2:K27,\$B2:\$B27,"")))``

Functions used:

• I've applied this formula to the spreadsheet, but it's producing wildly incorrect results. screenshot The green highlighted numbers are the ones that match the cell in column B, red do not. The formula is applied to the bottom of each column EXCEPT for column B (which has its own =SUM). The expected outcome is that the bottom cell would be the sum of the green numbers, while ignoring red numbers
– Alex
Commented Jan 21, 2020 at 21:07
• I had completely misread your question. The formula is now fixed. Commented Jan 22, 2020 at 22:33
• Thankyou, that's exactly what I needed
– Alex
Commented Jan 23, 2020 at 3:19