Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Average percentage every Interval

0

Hi,

I am looking for formula or VBA for Current Volume update calculation with Average Total Volume Start every defined interval i.e. 1 hr, 3 hr, 5 hr, etc.

Is there any possiblity that the current volume value can start the volume from every defined interval and calculate with the Average total volume. So, that we can get the result in terms of percentage between the current volume (start from zero at every interval) and the total average volume.

Let assume the Average Production is 10000.

The real time production updating every second.

The real time production volume to refresh every interval which is than divided with Average Production to get real time production taken in term of percentage for respective interval.

This way,  we will able to know how much production happen after every interval with respect to Average volume production.

Because, the current production is update on volume which gives total current production with Average Production volume.

Attached excel sheet for your ready reference. 

Let me know if you require more understanding of requirement.

I understand it is bit complicated task.

I am really hoping to get the solution.

Please help me for the solution.

Regards.

Answer
Discuss

Answers

0

Hi Sunil,

You are right. It's a little complicated. And it will take a lot of work. I want you to shoulder a larger part of that work. Let's do this together.

In essence, [LINK URL="' https://www.teachexcel.com/talk/5475/worksheet-event-for-sheetcalculate"]the solution is here[/LINK]. And this solution is based on a similar one I made earlier. I want you to study these solutions and then prepare your own project so that they can be implemented. It won't be a copy & paste matter. Instead the method will be adapted to your needs. I will do that eventually.

What's missing in your workbook?
You say that the current production volume updates every second. You want an average of those updated numbers. Your workbook has no place to collect the numbers. Therefore no average can be drawn. And your question doesn't define how that place should be managed. I imagine you will collect readings every second for 1, 3 and 5 hours, then draw an average when the time is up, delete the collected data and start afresh. Maybe so, maybe differently but apparently all 5-fold, for 5 production lines. Actually, this is a thread in itself and the solution is in the provided links.

Once the averages are collected you want them recorded and evaluated. The place to record them is in the table "Averge Production Data" which you have provided and the evaluation will be in Sheet1. The latter appears all done. The data on Sheet1 will change when the average production data change. I'm not sure I fully understand but now is not the time to correct any misunderstandings. Before you have collected the averages there is no need to design exact formulas for processing them.

What you do need to understand at this time is how to manage the calculations. That will be done by an automatic loop built by the same method as demonstrated in the linked threads, with a timer. You mention intervals of 1, 3 and 5 hours. That isn't clear. A timer can be set to run every hour, i.e. an interval of 1 hour, or "after" 1, 3 and 5 hours, or after 1 hour and then at an interval of 2 hours. This needs to be clarified but I don't think your workbook needs any adjustment. Anyway, that isn't the fist thing that will be done.

So, the plan I suggest is to do the average collection first, then the evaluation of the averages and, finally, create a timer system to run the evaluations automatically at the specified times. That is 3 threads (3 questions), each one with its own information, discussion and solution. Your part of the job is to neatly divide the tasks and provide the information for each in a timely manner. For that you need to understand the intended solution which you will after studying the linked workbooks.

Just bear in mind that you can't just ask 3 questions and expect 3 answers. The sequence is ask, implement, test and ask the next question building on the advance enabled by the previous answer. You will not be able to ask the second question intelligently before you have received and understood the answer to the first.

Your current question is both too large and too imprecise. I suggest that we should be satisfied to have made the plan here.

Discuss

Discussion

That's sound advice Variatus.

Sunil, I'd suggest that your project planning includes a later stage where the moving average data is displayed graphically. Managers are often more interested in trends than instant snapshots (and graphical data should makes it easier for them to see such trends). I think that will require more effort from you but it will be repaid well in your kudos. 
John_Ru (rep: 6142) Jun 12, '21 at 6:34 am
Aah! The voice of experience. Consider the suggestion Sunil. But that would definitely be another step - question #4 after the other 3 are working smoothly.
Variatus (rep: 4889) Jun 12, '21 at 6:56 am
Hi Variatus,
Thank you for your response message. 
Further, Please my below response in bold letter to your message.
What's missing in your workbook?
You say that the current production volume updates every second. You want an average of those updated numbers. I wanted average of  “Current Volume update” divided with “Average Volume” which already formulated D3:D7. Your workbook has no place to collect the numbers. B3:B7 is the real time update data feed which I need to refresh every defined interval i.e. every 1min, 3 min, 5 min, etc. Means the Range B3:B7 need to start with Zero every defined interval i.e. 1 min, 3 min, 5 min, etc. Therefore no average can be drawn. And your question doesn't define how that place should be managed. One solution come to my mind that if Range B3:B7 Automated copy paste to fresh Range may be H3:H7 and than we can calculate the difference of between Range H and Range C for Percentage In Range D for respective individual cell. 
I wanted this kind of result, but in better form.
Please let me know your understanding on above. So, we are in same page to take it forward.
Regards,
SunilA (rep: 58) Jun 12, '21 at 7:14 am
Hi Sunil,
I'm not in charge of form. If you want numbers from B3:B7 copied to H3:H7 every minute (or 3  minutes or 5 minutes) you can do that with the code I already referenced. 
It's not clear, however, how you want to calculate an average if you don't accumulate data. I also don't understand how you can express an "Average volume" as percentage but my preference is not to delve into those questions until after you have you regular automatic updates.
The solution for those updates is in the workbooks in the referenced questions. Just open those workbooks and transfer the code to your own project, making a few small modifications to change the addresses of sheets/cells to read from and sheets/cells to write to.
If you have a problem wih the modifications, post your workbook with the code in it, point to the problem and ask for help. We can't do that in this thread because we can't get to that question here. We have no idea what you might ask before you find the problem. I hope that you will find none.
Regards,
Variatus (rep: 4889) Jun 12, '21 at 10:29 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login