I'm having trouble with inconsistent calculated formulas when adding new rows in a table in Excel. For context, I adapted this video on how to create a searchable drop down list in Excel for a project I am working on. https://www.youtube.com/watch?v=vkPoViUhkxU
I'm designing a template which will be sent to other users and they will input their own data every quarter, so I need it to work properly as is instead of correcting formulas after data is added. The two columns that are giving me problems both have array formulas in them. They are both array formulas that include a fixed cell at the top of the column and then the bottom row of the array expands down the column. Basically, users enter data into columns B-E. To the right of a table (in cell J6) is a searchable drop down list. When something is typed into this cell, the formula in Column A updates to be a sequential count of all of the matches, with nonmatches being 0. Column G is a list of all of the matches and is the dynamic range populating the drop down list.
Column A: =IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A4)+1,0)
Column G: =IFERROR(VLOOKUP(ROWS($G$5:G5),A:H,6,0),"")
Here's my problem:
When I add new rows to the bottom of the table (whether I just paste new data or try and resize my table) the row that was previously the last row of the table almost acts as if it's the new last row of the table. For example, if cell G14 was the last row of the table prior to adding new rows (Row 15-31) the formula in G changes from:
=IFERROR(VLOOKUP(ROWS($G$5:G14),A:H,6,0),"")
to
=IFERROR(VLOOKUP(ROWS($G$5:G31),A:H,6,0),"")
The same problem is happening in column A, but at row 15. It changes from:
=IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A14)+1,0)
to
=IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A31)+1,0)
The problem only occurs in those rows and returns to normal afterwards, but does not work properly because of the disruption.
I'm posting a screenshot of when it is working properly after I correct the errors, and a screenshot of what it looks like with the errors. I am sending the template to users with minimum Excel experience and columns A,F,and G will be hidden, so I want the template to function correctly without needing to manually correct the errors after inputting new data.
Thank you for any insight into why the array formulas are being disturbed by new rows and how to avoid this!
I'm designing a template which will be sent to other users and they will input their own data every quarter, so I need it to work properly as is instead of correcting formulas after data is added. The two columns that are giving me problems both have array formulas in them. They are both array formulas that include a fixed cell at the top of the column and then the bottom row of the array expands down the column. Basically, users enter data into columns B-E. To the right of a table (in cell J6) is a searchable drop down list. When something is typed into this cell, the formula in Column A updates to be a sequential count of all of the matches, with nonmatches being 0. Column G is a list of all of the matches and is the dynamic range populating the drop down list.
Column A: =IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A4)+1,0)
Column G: =IFERROR(VLOOKUP(ROWS($G$5:G5),A:H,6,0),"")
Here's my problem:
When I add new rows to the bottom of the table (whether I just paste new data or try and resize my table) the row that was previously the last row of the table almost acts as if it's the new last row of the table. For example, if cell G14 was the last row of the table prior to adding new rows (Row 15-31) the formula in G changes from:
=IFERROR(VLOOKUP(ROWS($G$5:G14),A:H,6,0),"")
to
=IFERROR(VLOOKUP(ROWS($G$5:G31),A:H,6,0),"")
The same problem is happening in column A, but at row 15. It changes from:
=IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A14)+1,0)
to
=IF(ISNUMBER(SEARCH($J$6,C:C&" "&D:D)),MAX($A$4:A31)+1,0)
The problem only occurs in those rows and returns to normal afterwards, but does not work properly because of the disruption.
I'm posting a screenshot of when it is working properly after I correct the errors, and a screenshot of what it looks like with the errors. I am sending the template to users with minimum Excel experience and columns A,F,and G will be hidden, so I want the template to function correctly without needing to manually correct the errors after inputting new data.
Thank you for any insight into why the array formulas are being disturbed by new rows and how to avoid this!

