Forum Discussion
QUestion re Macros and Triggers
Is it possible for you to upload your actual workbook, without disclosing any confidential info?
I ask because in your opening sentence you describe yourself as "just feeling my way through the intricacies of excel," which I take to mean you're acknowledging being something of a beginner with Excel.
Assuming that to be true (and there's no shame at all in that; we all began at some point), it occurs to me that you might benefit from having different set of eyes look at what you're trying to accomplish and perhaps come up with an altogether different way to manage the data in question. It might, for example, make more sense to just maintain a single comprehensive database (in the form of an Excel Table), from which you use Excel to extract the current month's data (or any past month's, for comparison).
Excel has some wonderful tools for that kind of data extraction, summary display, analysis. Yet beginners often mistakenly try to do a lot of that "heavy lifting" on their own, essentially using Excel as if it were an automated ledger sheet, picturing it in their minds as helping doing the various mathematical calculations, but requiring the user to organize the info in a way to make it useful. Sometimes, that is the case. More often, or at least equally often, if you were to approach Excel by giving it lots of data (creating a database, in the form of an Excel Table), you could then use some of the reporting tools built in to it to "automatically" create the summary or analytical display that you want on a weekly or monthly or annual basis.
Hence my request: if you'd be willing to share the work you've already done, it's possible that someone here (I or somebody else) could recommend an altogether different way to think about and design your workbook, a more effective way to accomplish your real purpose.
If that doesn't appeal to you at all, that's fine. I'll defer to somebody else to give you aid on your presenting request.
Attached a version of one of the Workbooks I've set up. I've 'zeroed' out detail just to avoid any infosec issues.
In total there are three separate versions of this document for different locations and an additional document that pulls the total data from each of the 3 and presents them alongside a cumulative 'National' data total. That sheet is never touched by a user other than to view/archive for the month via a simple (paste to values) macro.
The archive itself is a folder of the individual documents with the 'National' data documents (saved monthly) further linked into an overall Year-to-date Document which pulls data from the National docs and separates into regions as well as showing month to month stock consumption (which managers will pull relevant charts and trends from as they require it)...That's a bit more intensive to zero out info, especially with all the network linked files it references, or I'd post it too.
^That make sense?
Right now it seems to be working well, but I suspect, in the coming months, I'll be asked if we can expand it to cover all stock, not just essential/hard to get at the minute stock.
Any comments or suggestions for improvement will be appreciated.
- mathetesJun 01, 2020Gold Contributor
Thank you for posting that file and all of that information. It does look like you're doing more than just "feeling my way through the intricacies of excel" -- there are some very sophisticated formulas in there (behind "protection").
It would be interesting to take time to get into the intricacies of inventory management, but to do so in any truly responsible way would really require both more time and a lot more access to your full system. I'd hesitate even to offer suggestions from this distance.
There are probably people here on the site who've a lot more direct experience with the field of inventory management than I [I've worked with a friend's very small business inventory and sales order database, but nothing more] , so maybe some of them will be able to offer more knowledgeable advice.
Have you looked through the various templates that can be found on-line?
- iapetustitanJun 01, 2020Copper Contributor
Thanks mathetes
The 'protection' on the sheets is really just to avoid any mishaps, each person that has access also needs to be able to run the macros to archive the monthly documents so it's really just a 'stop, are you sure?' measure.
I've mostly been searching for tutorials online, not used any templates as I had a sheet already drawn up when I was asked to get involved further (to be honest, I made work for myself by being unhappy with the 'everything on paper' plan the others in the department had come up with - lesson learned...don't help! Pretty much just putting into google what I want to happen and finding a tutorial that delivered. Still not 100% on what SUMIFS actually means but I understand what I need to put in it to get mydesired results - a wee bit of trial and error, linking two tutorials to get what I wanted (especially with that 'Consumed' section...real pain when they asked me for that but theres always someone helpful out there who has the advice you need).
All that said I think I will check out whatever templates are about online, see if there is a better, more streamlined way of capturing the required data. If I could find a way to add new stock layers in aphabetical or just product type order without re-jigging the whole thing I'd like that. Right now, I just tack on the bottom for everybodies ease of use.Thanks for the reponse.
Malc
- mtarlerJun 01, 2020Silver Contributor
iapetustitanso when I see mathetes say something is neat I want to take a peek 🙂 In general I agree with mathetes on good workbook design. In this case I suspect the 2 tabs are filled in by different people and may make sense to keep them separate. But the main reason I'm replying here is to encourage you to learn about cell references in excel and in particular how and when to use the '$' sign. For example you have col T on both sheets have a formula like:
=SUMIFS(E6:E500,C6:C500,N6,H6:H500,T5)You must have copied and pasted that formula into each cell changing N6 to N7 to N8 … as you went down the column.
There are a few ways to have Excel help you in these cases. You can:
- copy 1 cell, select the range you want to apply it and paste
- select the first cell and drag the little box in the bottom right corner down the whole range you want it to auto fill
- double-click that little box (works if you have a column next to it already)
- highlight the range you want and select 'fill down' from the menus
BUT in order for that to work right you need to let Excel know which of the cell references are 'relative' (e.g. the cell 1 to the left of me) vs 'absolute' (e.g. always look at cell A1). The default is 'relative' and you add the '$' to make it absolute. Further more you can make the column reference or the row reference 'absolute' independently. A simple example is if you have the number 1, 2, 3, 4, …. across the top row (row 1) and down the 1st column (col 'A') and you want to create a multiplication table you can create a formula in B2 =$A2 * B$1 which says multiply the cell to my left by the cell above me. And then as you 'fill down' and 'fill right' excel will auto increment the 'relative' parts and keep the 'absolute' parts. So in B3 it would become $A3 * B$1 because '$A' means always use col A but the 2 was changed to 3 because that was 'relative' (i.e. the same row as 'me' and the formula was in B2 but now it was copied into B3). The B$1 stayed the same because you copied from B -> B so although it is relative, that didn't change and the $1 says to keep looking at row 1.
phew...
now back to your formula what if you had used:
=SUMIFS($E$6:$E$500,$C$6:$C$500,$N6,$H$6:$H$500,T$5)Notice all the '$', because the ranges E6:E500 and C6:C500 and H6:H500 are all fixed 'absolute' ranges. Because you are only filling down 1 column you could ignore the $ in front the columns but in case you decide to copy it I thought it would be good to have. But NOTICE that $N6 does NOT have the '$' next to the '6' so as you copy that cell formula down the rows it will automatically increment accordingly.
There are lots of other things you can also use and learn like referring to a whole column (E:E) or using named ranges, or the new FILTER function, but learning about the '$' is a 1st.
Keep up the good work.