I have a test table below that represents a table on a much grander scale with more rows and columns
Date key ID Sample Name Business
test test test test test
test test test test test
test test test test test
test test test test test
test test test test test
test test test test test
It is important to note that this table is populated by a copy and paste from another data source. I have a countif formula that gets the count of all instances of "test" in column "Business", but I run into a problem if the original data source that is copied over decides to add a column before the "Business" column. When I copy and paste the data, my countif formula is going to look for items in column(5), when it should now be looking in column(6). I created a formula below to catch this dynamically, so the countif range picks up the new column reference, but the calculation is adding double quotes around the cell range and giving me an error.
--Dynamic formula
=SUBSTITUTE(ADDRESS(1,MATCH("Business",A1:A5,0),4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MATCH("Business",A1:A5,0),4),"1","")
--New countif formula
=COUNTIF(SUBSTITUTE(ADDRESS(1,MATCH("Business",A:E,0),4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MATCH("Business",A:E,0),4),"1",""),"test")
When I highlight the dynamic formula and press F9, you can see how the double quotes are assigned to the formula, thus giving me the error, shown below. How do I fix this, so I can allow the formula to have the dynamic ability to always give me the count of the specified column regardless of how many columns are added or changed?
=COUNTIF("E:E","test")