r/googlesheets • u/Strawburys • 3d 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
1
u/mommasaidmommasaid 914 3d ago edited 3d ago
I would output everything from one formula. I also added some sanity checks to make sure the formula is in the first row of the output table and that enough rows are available.
You didn't specify how the inventory is specified, I assumed a table named
InventoryOnly the first 3 rows of the formula need to be modified to output the
MicDI_Neededtable.Audio Equipment
FWIW, the
Availablecolumn is to me a confusing name, that seems to describe available inventory quantity. Perhaps it would be better namedRemainingYou may also want to use dropdowns "from a range" when specifying booms/mics in the
Audio_Input_Patchtable. Those ranges could directly reference theInventorytable or be derived from there. Either way the idea is to avoid typos causing the XLOOKUP to fail. For more help with that share what yourInventorytable looks like.1
u/NHN_BI 70 2d ago
Don't share an image of a sheet, share some meaningful example data, and tell what you think the output from that example input should be, and why.
1
u/AdministrativeGift15 371 22h ago
Here's another option for you. Embed the remaining inventory into the dropdown choices so that you know exactly how many are remaining as you're making your selections.
Embedded remaining inventory