How to Subtract a value from the oldest expiration date and move to the next once it hits zero? - excel

I work for an organization and I am working on a way to better organize our part numbers that have expiration dates. I've started off by making an Excel sheet that has the part number multiple times based on the expiration date and then had the matching quantities of that expiration date. What im trying to do is what you always do in life, if something is going to go bad use up the one that will expire first. But now trying to do this in an excel table automatically. This is my Ex: my master log where they will put in the Part#, expiration date, and quantity, this is where most info will be pulled from.
I am now on to taking away our companies forecasted usage of these parts away from these quantities to show an overall usage over the months and pairing the intersecting expiration dates. I’ve got the Usage by using a pivot table to total these part numbers quantities. And I’ve made a chart mapping the overall usage to part quantity forecast with it being flagged if the expiration date interferes with the actual date. This is the forcasting for what we plan to use of each part #
This is me subtracting the usage number from the inventory of those part numbers and it being flagged when it expires.
=IF((IF((VLOOKUP($F60,Expires!$1:$1048576, 10, FALSE))<Sheet1!G$58, "Bad", "Good"))="good", T33, "Expired")
I used this function, my vlookup pulling from my first sheet and pulling the part numbers expiration date and if it is <the date up top (9/1,10/1 etc.) then it will be flagged as expired and wont even show the usage. T33 is simply pulling the fromual from another table which is just quantity- usage. Please lmk if this looks right my vlookup turns out pulls the latest expiration date from the multiple part #s.
But that is with total quantities, not separated based on the part number expiration dates. What I am wondering is how can I make a table like this but subtracts the usage from quantity of the part number that will expire first? Then after that quantity hits zero it takes away the usage from the next one due to expire? But also I want the Numbers to be able to auto populate from the sheet where the user enters the data (master log).
So this is what it will be doing and will look like the table above multiple of the same part number. Whats happening now
But needs to look like this Final table and add the part number to the list and quantity as they are entered in the master log. I was trying to do a Vlookup(MIN and take the part number from the other table based on the lowest expiration date first but I don’t think excel is capable of that, I’m not sure here.
Please help, thank you!

Related

How to create excel pivot table measure that calculates the value in a table at the end of the month

Given a set of data similar to:
which is a journal of account balances, some of which may be from statements, some may be manually entered. The key issue is that the data may be sparse, because my savings account only provides a statement once a quarter. In addition, balances are on different days of the month. It might even be possible to have two entries for the same account in a given month.
What I want to do is to create a measure that calculates the balance of each account on the last day of the month using the most recent value for that account prior to the end of that month.
I simulated this in the following table using max for the measure, which works for account/month pairs with a single value.
it doesn't fill in the previous value for missing values
max is not a valid measure if there is more than one value for the month.

Dynamic Sales Summary Depending on Month (can't use MAXIF/MINIF)

I have a student license of Office Pro 2016, but somehow it doesn't have the IFS, MINIF/MINIFS, MAXIF/MAXIFS functions that would make my life so much easier. I tried to illustrate what I'm doing in the image below:
Example
My actual data is much more complicated and long, but the idea is that I will periodically manually update data within the DATATABLE, and I want the SUMMARYTABLE to reflect the total pending sales by month. There are never more than two months pending at a time, and if only sales from one particular month are pending, I don't want the second row to appear.
I've already found a way to display the month in this case using regular MAX and MIN functions, but now I'm stumped as to how to display the sum total of sales within those months. Specifically, I don't know how to make a reference to a particular month in my criteria.
I've tried this formula:
=SUMIFS(DATATABLE[SALES],DATATABLE[SHOP]="A",DATATABLE[STATUS]="PENDING",MONTH(DATATABLE[DATE]),SHOPATOTALS[MONTH])
If this worked it would have been perfect, but the month portion isn't recognized as a proper range.

How Do I Nest IF Functions in Order to Calculate Daily Revenue?

I am working on a data set and I need to calculate the daily revenue of fake AirBnb listings using nested IF statements. This is for a bootcamp I am attending, and I am stuck.
My instructions are as follows:
Estimate revenue per listing
Assume each booking always has 2 guests, unless the listing accommodates only one;
The booking is always for the minimum number of days allowed;
Only half of the bookings generate a review;
The extra person charge is per night (column name ‘extra_people’)
○ Format: have a column that calculates daily revenue (account for number of guests accommodated, number of guests included in the price, extra charge for additional people - using nested IF statements); another column would then calculates revenue per booking; finally, multiply that by the number of total stays the listings has had.
Using the data in my dataset, I am attempting to fill out column AA. So far this is what I have for my formula,
However, I get an error. I know the first part of this formula would work for the scenario in row 4. However, I need to make sure that the formula takes into account scenarios where the "guests included" is less than the "accommodates", because I must assume that each booking always has two guests except for when the listing only accommodates one person.
How should this formula be written? Can I not create equations within nested if formulas if it includes adding, subtracting, dividing, or multiplying columns together?
To clarify the previous response a bit more, the structuring of IFstatements is important. Keep in mind the structure of the function: =IF(logical test, value if true, value if false). So, the second IF function (the first nested) needs to be placed where the first "value if false" comes in - each additional IF needs to be within the previous IF function. Using your example, the corrected form would be =IF(W4=Q4,V4,IF(W4<Q4,Q4*V4...)). I'm not sure what the "+X4" is supposed to be adding to, but this hopefully makes the structure clearer for you to work with. Good luck!

Access DB: Daily cumulative count and daily number on assignment

I have a table that tracks the dispatching of personnel. The table has the employee name and the date the person went out and the date they returned.
The table has hundreds of entries from 1988 to current.
In Excel I track the cumulative count per day (of the year) of how many people have been sent out, and I also track the number of people out on any given day. The table lists the Month & Day in the first column (every day of the year, including leap days) and the years on the first row. There is data for every date (a zero is entered until the first person is sent out that year, then starts counting up as there are more dispatches, or in the case of the number of people out each day, it will show zero if no one is out that day or if there were, say 5 people out, it would show "5" for that day). I then use the data in Excel to construct a graph that shows the number of dispatches on the y axis and the day of the year on the x axis (along with the current year’s number, the average number and the max over the 27 year history). Currently I just track this manually (I just keep a running count of each and enter it in manually in Excel.) I would like to build a query of my Access data that would return the same information that I could import into my Excel spreadsheet. One query that would show the day & month in the first column and the years along the top row and for each day show a cumulative count for that year of how many people have been sent out. Another query that has the day & month in the first column and the years along the top and a count of how many people were out for that particular day for that particular year. There shouldn't be any gaps (every day has data, even if it is "0"). I would then import those queries into Excel to replace my manual tracking that I am doing now.
I know how to construct the Excel stuff (I have that running already), and how to import info from Access to Excel, what I need to know is how to construct these 2 Access queries.
Any help/ideas on how to construct those 2 queries would be greatly appreciated!
I'd recommend that you migrate this app to a web based solution that uses a real database - SQL Server or MySQL, not Access.
"Desk drawer software" is what I call homegrown apps that someone creates for themselves to perform some small task that eventually become integral to running a business and grow out of hand. Your truck factor is 1: if anything happened to you, no one would know how to do this function. The software may not be backed up or checked into a source code management system. There's no QA. There's no way to migrate new features to production: if you alter the app, then that is what you have.
I'd recommend a web app to mitigate all the risks I've described:
You have to deploy a web app to a server, which takes it off your desktop and puts it in a central place where anyone who's authorized can access it.
Separates database from display issues.
Makes you think about how to archive historical data. Partitioning by year makes sense.
Likely you'll put this in a source code management system like Subversion or Git.

Attendance Calculations / Period Calendar

This is a multi-tiered project. Let me give a quick overview. I have attendance data, card/ timestamp punches. I would like to have a pivot table with slicers in Excel. Ideally you'd be able to choose a department / last name / associate number. And also a period of time. Ideally this would be a table with the company period/week. And maybe default to last weeks.
I can get at timecard data in two ways:
(1) generate a CSV that automatically performs the timecard math, to figure out how many hours someone worked and it is smart enough to understand 3rd shift workers. The format of that CSV is:
Last Name, First Name, Personnel Type, Associate Number, Facility, Department, TimeIn, TimeOut, Total Hours
The problem with this method is that I would have to manually append the information to the CSV tables. Or come up with some autoIT script.
(2) Get at the raw data via sql/odbc. This way the math is not done. It is just all of the associates timestamps. I would have to figure up the daily hours myself and figure out a 3rd shift formula too. It is not a set schedule, many people swing shifts and others get called in a lot.
Lastly, I would like to be able to filter the dates by using our company fiscal calendar. I have a spreadsheet that goes from 2000 to 2093. With everyday listed and it's corresponding year/period/week.
Example period info spreadsheet:
date Year Period week WeekTotal Period Total
12/3/2007 2008 1 1 2008.1.1 2008.1
12/4/2007 2008 1 1 2008.1.1 2008.1
I know there is a lot going on here, but what would be the best way to approach this project?
First I have not been able to post any script however the last I tried it I used two options 1. Was a php conversion where the time was numbers ( which makes it easier for calculations)
2. Was in the tables where I deliberately entered the values places the time in different columns or fields for hours, mins, and seconds this meant that while the input is eased I still have to calculate the output in php especially for totals, averages and differences.
Hope it helps a bit

Resources