SUMIFS formula possible with current worksheet formatting?

Lil Stinker

Board Regular
Joined
Feb 16, 2022
Messages
143
Office Version
  1. 2019
Platform
  1. Windows
Hey folks-
I am looking for some formulas that will give me an accurate Stock In / Stock Out / Damaged Stock / Equip Available assessment based on how our Inventory Sheets are currently formatted. Our equipment is rental, not purchases and sales, so I need to be able to track the inventory as it goes out, comes in and what's left over in between. Below are basic examples of how the sheets are formatted. Sheet 1 shows equipment out, Sheet 2 shows equipment in and/or damaged based on the varying intervals the equipment is returned and Sheet 3 is the balance sheet with the initial count. I'm having difficulty finding a way to properly SUM the Outs and Ins so the values in blue indicate the desired results.

I've tried a variety of SUMIF/SUMIFS formulas but either end up with the wrong result or #VALUE which I suspect is resulting from my quantities being laid out across multiple columns instead of a single column in multiple rows? I've also set up dynamic named ranges since my data is not formatted in tables for each equipment type. I've been at this for days and cannot seem to find anything that resembles our setup. Short of creating separate tables and transferring the existing quantities over, I'm at a loss. I feel like this should be simple but I've always had a difficult time spotting what's right in front of my nose. Any help would be appreciated.

Sheet 1 (invOUT)
Inventory Sample.xlsx
ABCDEFGH
1RA NoOpen DateDate OutExp. ReturnAntennasSurveysBattsHeadsets
2100006/2/20236/2/20236/12/20231313130
3100016/9/20236/9/20236/19/2023130101950
4100028/1/20238/1/20238/10/20231001510
invOUT


Sheet 2 (invRTN)
Inventory Sample.xlsx
ABCDEFGHIJKLMNO
1uIDRA No.RTN No.Open DateReturn StatusDate OutReturn DateAntennasDMG AntsRTN SurveysDMG SurveysRTN BattsDMG BattsRTN HeadsetsDMG Headsets
2110000006/13/20236/2/202300000000
3210001006/21/20236/9/202300000000
4310000016/13/2023Full6/2/20236/14/202313013013000
5410001016/21/2023Partial6/9/20236/12/20231301100195000
6510001026/21/2023Partial6/12/20238/8/202300000000
invRTN


Sheet 3 (invBAL)
Inventory Sample.xlsx
ABCDEF
1Quantity
2StockItemsTotalOutInDmgAvailable
3Antennas825108151814
4Surveys13601362134
5Batts328015326503265
6Headsets611051051
invBAL
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Convert your ranges to tables, then it's easy

StockItemsTotalOutInDmgAvailable
Antennas8251538151814
Surveys136231360134
Batts3280223326503265
Headsets611051051


Out Column -> =SUM(INDIRECT("invOUT["&[@StockItems]&"]"))
Dmg Column -> =SUM(INDIRECT("invRTN[DMG "&[@StockItems]&"]"))
 
Upvote 0
I was able to get these results using named ranges for the OUTs, RTNs, and DMGs. Setting up the named ranges was the tedious part...named range for Antennas_Out is:
Excel Formula:
=OFFSET(invOUT!$A$1,1,MATCH("Antennas",invOUT!$A$1:$H$1,0)-1,COUNTA(invOUT!$A$2:$A$1000),1)

For whatever reason, XL2BB will not bring in my named ranges. I am guessing, it is because their scope is "Workbook" rather than the worksheet.

Book1
ABCDEF
1Quantity
2StockItemsTotalOutInDmgAvailable
3Antennas825108151814
4Surveys13601362134
5Batts328015326503265
6Headsets611051051
invBAL
Cell Formulas
RangeFormula
C3C3=SUM(Antennas_Out)-SUM(Antennas_Rtn)
D3:D6,F3:F6D3=B3-C3
E3E3=SUM(Antennas_Dmg)
C4C4=SUM(Surveys_Out)-SUM(Surveys_Rtn)
E4E4=SUM(Surveys_Dmg)
C5C5=SUM(Batts_Out)-SUM(Batts_Rtn)
E5E5=SUM(Batts_Dmg)
C6C6=SUM(Headsets_Out)-SUM(Headsets_Rtn)
E6E6=SUM(Headsets_Dmg)

As suggested by @bassplr19, having the data in a Table would make the task much easier.

Hope that helps,

Doug
 
Upvote 0
Solution
Thank you both for your guidance. This was a classic case of overthinking on my part. I was stuck thinking only SUMIF/SUMIFS would work due to the quantities being contingent on other criteria like the dates in or out. Turns out the simplest solution is often the best.

@bassplr19 I'm sure you're right that tables would make everything easier however, I'd be hesitant to convert to tables at this point because this is just a small part of a much larger project that includes all sorts of VBA. My main concern would be breaking any of the VBA tied to these worksheets. Thank you though! I'll keep it in mind for future projects.

@duggie33 Indeed, the tedious part is all the Named Ranges which I already went through and set up. That was exhausting (and to think there are twice as many items in my full project vs. this small dataset). I also noticed my Named Ranges did not copy over from XL2BB. But your formulas are what broke the barrier I was stuck behind. I can't believe it didn't occur to me to simply sum the individual ranges and subtract the OUTs from the RTNs. Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,079
Members
449,094
Latest member
mystic19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top