I'm setting up a database containing information of production runs. Each production run usually takes place within 24 h, leading to about 7 runs/week. Multiple values and variables are entered into the database, giving an idea how well/poorly each run went. I want to visualize this information in graphs, which give a weekly view (so 7 runs in 1 graph). My idea was to have a 2nd worksheet where I can input a week number, having Excel then show all runs (and all their relevant info) that took place in that week. This set area could then be used to fetch info for the graphs from. Idea being, I input a different week number, the values in this area change based on the runs for the new week and the graph looking at this are will automatically update.
I've been working with HLOOKUP based on dates, which works fine if 1 run takes place on 1 day.
Example: =HLOOKUP(D$2,'Run Values'!$C$6:$XFD$54,3,TRUE), where D$2is the date on which the run took place, 'Run Values!$C$6:$XFD$54 is the range where the values for each run can be stored (2nd worksheet), & 3 is the row for this particular piece of info (this value changes per row that I use the HLOOKUP in, depending on what I'm looking for).
However, when for some reason multiple runs took place on the same date (which occasionally happens), it only retrieves the first run encountered for that run. This is probably because I'm checking per date.
Is there a way to either improve this code (using HLOOKUP) to get it to do what I want it to do? Or is there an alternative (maybe more easy) way to get to where I want to be?
Sample data consists of weeks placed next to each other (1 week of data here):
43
43
43
43
43
25/10/2021
26/10/2021
26/10/2021
27/10/2021
28/10/2021
659
660
660
661
662
879
880PUR
881
882
883
34157
23034
27224
41740
40062
29.06%
29.75%
28.29%
27.51%
26.57%
12.58
9.65
9.65
14.20
16.17
I'm looking to extract the 1st through 4th row of the green values, 2nd through 9th row of the blue values, all of the light orange and all of the dark orange values for an entire week, and all this for 1 week of data at a time. So if I would request week 43 on my second worksheet, then it would retrieve them from this data base as such:
Any help would be much appreciated.
Related
Let's say we have time slots documented in which a production line was running. In between each product maufactured are time slots in which the machine was idling.
I now want to plot the machine status over time, basically as a boolean value (running vs idling).
I get the machine log and need the chart on the right.
The machining duration will ultimately be logged including seconds and may vary for each product.
The first - and probably biggest - challenge for me is to find a smart way to extract the status from the time stamps. My current first step ist to create a table row for each minute and use the if statement in H4 to check wether article 1 was being manufactured.
IF(AND([#Time]>Machine_log[#Start],[#Time]<Machine_log[#Finish]);;)
However, since the final list will range over 24 hours or more and the number of articles quickly reaches 50 and more, I would love to avoid using nested IFs on this one..
I'm thankfull for any input and open for inspiration :)
Thank you all in advance!
PS: Anyone know how a better way than a scatter chart with two values per X-Value to display the chart as vertical lines/right angles like this?
One option is to add only those points that are necessary to the Status extraction table (which I named "Status"). (I named the Machine log table "Log").
Note: it looks like you are using a semicolon list separator, so you'll need to change the commas in the formulas below to semicolons.
Formula for the Time column:
=IF(ROW()=ROW(Status),MIN(Log[Start])-1/144,IFERROR(INDEX(Log[[Start]:[Finish]],INT((ROW()-ROW(Status)-1)/4)+1,MOD(INT((ROW()-ROW(Status)-1)/2),2)+1),MAX(Log[Finish])+1/144))
Formula for the Production running? column (enter into H4 and fill down):
=IF(SUMPRODUCT(--(Log[[Start]:[Finish]]=[#Time])),IF([#Time]=G3,3-H3,H3),1)
These formulas will pad your plot with 10 minutes of off time on either side.
To answer your question about avoiding two points for each x-value: no, each point on the plot has to have a corresponding data pair.
UPDATE IN RESPONSE TO COMMENT: I failed to mention that the above solution assumes the time data in the Machine log table are in ascending order. This means that if your data span more than one day, they will need to contain a date component or you can get plots where the line crosses back to the beginning. For example, if you have 23:57:00 followed by 00:10:00 with no date component, Excel treats these as 11:57 pm on 1 January 1900 and 12:10 am on 1 January 1900. (To see this, change the format to "General", and you'll see the values that Excel uses to encode date-time aren't in ascending order.) The solution is to enter the dates as "8/16/2020 23:57:00" and "8/17/2020 00:10:00" in the formula bar. If you're copying over from another data source, the date needs to be copied with the time. If the dates and times are in separate columns, your Start and Finish columns would each be a date column plus a time column.
I have been collecting data over the past few data from an energy metering project i have set up.
The values that are recorded are saved in a CSV file and then extracted through usb drive.
i have opened and assessed the CSV file in excel and the data hasnt been recorded how i would like.
Instead of logging once every minute it has logged every 7 seconds.
This has created a problem as the template csv file i have created to average these figures wont work now.
i am trying to create a VBA marco to assess all the data and where the second value is higher then 6 seconds, i want it to delete it for example:
here is some of the values i am working with:
16:29:05 PAC3 239.8030701 50.01350021 1073.719116 4.450771332 0
16:29:05 PAC2 239.2398834 50.01499939 3046.500732 12.62684536 0
Above is how i would like it to look.
but it currently looks like below where there are several entries under the 16:30 time
16:30:02 PAC3 239.6912689 50.06306076 1092.592651 4.229027748 0
16:30:02 PAC2 238.8809052 50.06230927 3535.760254 14.82234478 0
16:30:09 PAC3 239.8191681 50.07057571 999.7850342 4.125905514 0
16:30:09 PAC2 239.2037506 50.06982422 2644.371338 11.05446911 0
because it is logging every 7 seconds i am getting about 7 - 8 logs per minute per PAC
so where the second value is greater than 6 seconds i would like the whole row to be removed. and continue to cycle through the entire column and remove them. These cells are formatted into a time format but do contain a time and data value
I have searched for ways to complete this task but have found no solutions
any help appreciated.
If you use =SECOND() function you can extract the seconds from the time value. Then loop up the column starting at the bottom and delete the rows that contain the values you don't want.
I am trying to create a running total based on 4 criteria but can't seem to get it to work - sorry very new to both powerpivot and DAX.
I have a Query that has a total of 17 columns - 13 actual data and 4 calculated.
I want to get a cumulative total based on 4 criteria.
I haven't even been able to get 1 criteria working so far:
CALCULATE(
SUM(Tonnes),
Filter(Query,[Deliveryid]=[Deliveryid])
)
Basically want to sum all the tonnes for each deliveryid - this is simple in a pivot, but i want to eventually do this for all dates before the date value in the row and for each commodity and delivery address etc.
Any help would be appreciated.
Regarding your specific requirement to sum all the tonnes for each Deliveryid, you're close. Try this: =CALCULATE(SUMX(Table1,[Tonnes]),FILTER(Table1,[Deliveryid]=EARLIER([Deliveryid]))). It will sum the Tonnes for each Deliveryid.
Regarding your follow-on desire to sum all the tonnes for each Deliveryid for the dates preceding the current date, try this: =CALCULATE(SUMX(Table1,[Tonnes]),FILTER(FILTER(Table1,[Deliveryid]=EARLIER([Deliveryid])),[Date]<EARLIER([Date]))).
The table below might help show what these do (I used very long column titles to hopefully make this more understandable):
TotalTonnesForDeliveryid (made with the first code item above) simply totals tonnes by Deliveryid. In the table below, you see the TotalTonnesForDeliveryid for Deliveryid 1 is 91 tonnes ... 38 (from 1/1/2017) + 23 (from 1/3/2017) + 30 (from 1/6/2017).
TotalTonnesForDeliveryBeforeCurrentDate (made with the second code item above) totals tonnes by Deliveryid only for the dates preceding the current date. The reason TotalTonnesForDeliveryBeforeCurrentDate shows blanks for first occurences of Deliveryid is because there was no prior delivery. If more than one delivery has been made for a particular Deliveryid, each following occurence of the Deliveryid shows an accumulation of the previous dates' tonnes. So for Deliveryid 1: the initial delivery date (1/1/2017) shows blank TotalTonnesForDeliveryidBeforeCurrentDate (because there was no previous delivery); the second delivery date (1/3/2017) shows 38 tonnes (which is what was delivered on 1/1/2017); and the third delivery date (1/6/2017) shows 61 tonnes (which is the 38 from the first delivery + the 23 from the second delivery).
In an Excel 2003 spreadsheet, I have the top row of cells calculating the number of days and hours I have worked on something based on data I put in the cells below for each category. For example I enter the time spent on Programming, Spoken languages, house, piano, guitar...etc. The top cell in each category will keep track of and display how many days and hours I spent as I add the time spent for each category each day. I want to evaluate this top row and then list in a "report" (like a pop up box or another tab or something) in order from least amount of time to the most amount of time. This is so I can see at a glance which category is falling behind and what I need to work on. Can this be done in Excel? VBA? Or do I have to write a program from scratch in C# or Java? Thanks!
VH
Unbelievable... I've been scolded for trying to understand an answer and requested to mark this question answered. I don't see anything to do this and could not find anything that tells you how, so I'm just writing it here. MY QUESTION WAS ANSWERED... But thanks anyway...
Consider the following screenshot:
The chart data is built with formulas in columns H3:I3 and below. The formulas are
H3 =INDEX($B$3:$F$3,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
I3 =INDEX($B$2:$F$2,MATCH(SMALL($B$2:$F$2,ROW(A1)),$B$2:$F$2,0))
Copy down and build a horizontal bar chart from the data. If you want to change the order of the source data, use LARGE() instead of SMALL().
Alternative Approach
Instead of recording your data in a matrix, consider recording in a flat table with columns for date, category and time spent. That data can then easily be evaluated in many possible ways without using any formulas at all. The screenshot below shows a pivot table and chart where the data is sorted by time spent.
Edit after inspecting file:
Swap rows 2 and 3. Then you can choose one of the approaches outlined above.
Consider entering the study time as time values. It is not immediately clear if your entry 2.23 means 2 hrs and 23 minutes, or 2 hrs plus 0.23 of an hour, which totals to 2hrs, 13 minutes.
If you are using the first method, then all your sums involving decimals are off. For example, the total for column B is 7.73 as you sum it. Is that meant to be 7 hrs and 73 minutes? That would really be 8 hrs and 13 minutes, no? Or is it meant to be 7 hrs and 43 minutes? You can see how this is confusing. Use the colon to separate hrs and minutes and - hey - you can see human readable time values and don't have to convert minute values into decimals.
I am working with a weather data set. I am particularly interested in two columns which are cumulative precipitation and a date. My question is a simple one, though I am struggling to figure out the solution. Essentially I am wanting to determine days since precipitation. An example of the data is as follows:
WEATHER DATA
Pr Date
40 8/8/2013
40 8/8/2013
40 8/9/2013
40 8/9/2013
41 8/10/2013
41 8/10/2013
In this example, if I know the last day it rained was 8/7, then 8/8 would have a value of 1 (days since precipitation), 8/9 would be 2, and 8/10 would go back to 0. I have multiple dates because of hourly recordings (I trimmed it down for this post). I've been trying to figure it out with conditional if|then statements, but I'm thinking VBA may be more appropriate here. Any help or insight would be greatly appreciated.
Assuming cell C2 to be equal 1 (or start where you wish by adjusting the C2 value), the formula below works in the example you provided. Type in C3:
=IF(A3<>A2,0,IF(B3=B2,C2,1+C2))
Drag the formula down. Explanation:
If precipitation from time i+next is different from i it comes back to zero --> there was rain.
If time i+next is equal i, then it compares the date d+next with d.
If they are equal hold the number of days without rain from previous cell.
If they are not, add 1 day* to the value inside previous cell.
*I'm assuming you have consecutive days from the following sentence:
I have multiple dates because of hourly recordings