I've tried deleting the checkbox at the specific cell mentioned in the error, but then it just changes to another one.
This is what it is trying to return:
This is what is in the way:
When an array formula needs to write data in a cell that already contains data, you will get a #REF!
error that reads: "Array result was not expanded because it would overwrite data in [cell address]"
The error lists the first cell it encountered with data, which in your case was H2
. But, as you discovered, clearing data from that cell may eliminate the error if it encounters more data in its way it will list the next cell.
The array you are trying to return wants to fill the range G2:J5
but you have data in the range H2:J5
In order to avoid that error you would need to clear data from each of the cells in the range H2:J5
i.e. { H2, I2, J2, H3, I3, J4, H4, I4, J4, H5, I5, J5 }
Show Checkboxes (vs. TRUE/FALSE)
Your formula returns TRUE/FALSE values. If you want to return checkboxes here are two options.
Option 1: Replacement Characters
** This is my recommended option **
You can SUBSTITUTE characters for your TRUE/FALSE values. These characters will not be dynamic checkboxes. This should not matter since the TRUE/FALSE state of these cells cannot be individually changed. All the cells' states are controlled by the array formula in cell G2. You could use any character including many emojis.
Examples: 🗹 ✓ ✔ 🗸 ✅ ❌ x ☐ - etc.
These characters can be used in formulas just like you would regular checkboxes =IF(A1="🗹",TRUE,FALSE)
Here is an example formula using TRUE = ✔
and FALSE = -
={ B1:E1; ARRAYFORMULA(
SUBSTITUTE(SUBSTITUTE(FILTER(B2:E, B2:B=G1),
TRUE,"✔"),FALSE,"-"))
}
Option 2: Helper Columns
** This is NOT recommended **
If you really want to use checkboxes, you could use helper columns to determine their state.
- Put your original
=FILTER(B2:E, B2:B=G1)
in another column in the same sheet or a different one.
- Put checkboxes in each cell in the range
H2:G2
and as many rows as will cover the most rows of results that could be returned by your formula.
- Put an ARRAYFORMULA in
G3
to return the "Class" from your first helper column =ARRAYFORMULA(L3:L10)
- Link the value in
H3
to the value M3
(helper table Row1, Col2), and then copy that formula across all the checkboxes
- [Optionally] Create a Conditional Formatting rule for the range of checkboxes based on IF the value in the "Class" column
=""
(is empty) that changes the font to match the background color (white in my example) hiding them from view. * Sheets will allow you to toggle hidden checkboxes, overwriting the formula, by mouse-clicking, but will warn you first. Sheets will not toggle visible checkboxes with formulas via mouse-click