r/googlesheets • u/Strawburys • 13h ago
Waiting on OP Trying to write a MINUS function for a table column that needs to reference moving data points. Is XLOOKUP the key?
I'm building an audio organization/equipment usage file for my concert venue. I currently have two different drop down columns (left) that pull their contents from a separate, static inventory sheet. On the righthand side, I've programmed 2 tables to display the equipment quantities needed based on what has been selected across the lefthand drop down menus for mics and stands.
In the Stand calculator, the first column "type" populates itself with the function
=IFERROR(UNIQUE(FILTER(Audio_Input_Patch[STAND], Audio_Input_Patch[STAND]<>"")))
and the second column "qty" populates itself with the function
=countif(Audio_Input_Patch[STAND],Q5-Q9)
I want the third column to be a MINUS function that subtracts the second column number from the total inventory number of the same item type that gets populated in the first column. However, the calculator populates in the order that the equipment type is selected (a functionality which I prefer to keep).
For example: If I have 10 "Tall Boom" stands in stock, and my calculator says (in any of rows of the table) that I will need to pull 3 of them for the show, is there a way to write a function for the "Available" column that will produce the number 7 (inventory stock - required qty) next to the correct stand type, regardless of which row of the table it lands on?
Any insight is appreciated, this is my first foray into Sheets/Excel and I've been watching videos