So I have a search file in order to find alarm panel numbers for a site where I work. I set up a table for the different buildings, another table for the areas within each building, a table with the buildings as the table headers (each column is a named range), a table that identifies each panel number with its specific area, and a column that indexes specific areas depending on what building is selected in the first combo box. The issue I'm running into, is that because the "Active Building" column uses index formulas, the "Blank" cells aren't actually blank, so the Offset>>CountA formula leaves up to 21 empty spaces in the area selection that I'm using as the ComboBox's ListFillRange. Further, if I try to use Countif, or sum, then the ListFillRange only generates one answer, even if there are more.
I've tried using variations in the formula for the Dynamic Named Range, Countif, Countifs, Sum, or even just setting the Offset height at a specific height and it just leaves me with the one answer.
It seems like no matter what I change it to, it's either going to give me a bunch of erroneous blank answers, or not enough answers
EDIT: Now I'm figuring out that the combobox is populating with the most recent update on ListFillRange (LFR) that I SPECIFICALLY input myself. So if the Countif(Active, "?*") was last calculated as a high number, then when I fill in the LFR and hit enter, it populates the combobox as having that high number of rows, and it doesn't matter if I change the building to one with only one entry, it'll still show all 21 rows. Likewise, if I fill in the LFR while the Countif contains an answer of 5, then it will populate the ComboBox as only having 5 entries, even if I change the building selector to something with more entries.
Is there a way to make the LFR recalculate each time the Building selector (or its linked cell) updates?
So, like most things on Excel. Once I found the answer it was obvious, and I felt really stupid for not having thought of it sooner.
Like @Rory said, COUNTA
doesn't go with OFFSET
in this scenario, but the COUNTA
vs COUNTIF
wasn't the issue.
COUNTIF
was working perfectly, the ComboBox just wasn't updating each time the ListFillRange
updated.
I needed to add some VBA to the mix
I solved the issue with this. Since the Location (ComboBox2) needed to update when the Building Selection (ComboBox1) was changed, I added this code specifically to ComboBox1.
Private Sub ComboBox1_Change()
ComboBox2.ListFillRange = "=ActiveX"
End Sub
That effectively solved my issue so I'll mark this as the answer. If anyone has any questions I'm happy to discuss this further.
..Damn I feel stupid..