How to auto link columns from different sheets for a template

I am trying to setup a template that will auto work with our Revit exported spreadsheet. I have had no problem with it until I get to linking the quantities per room. I want to have it search for the right item number and then proceed to list the quantities and the room names down the list in order and then not put in "0" or miscellaneous text from somewhere else, I only want it to read each item's info and not skip to another. See attached images for a better understanding. Is this possible?

AttachmentSize
Capture.PNG22.02 KB
Capture2.PNG47.27 KB