jvandeliefvoort
New Member
- Joined
- Nov 10, 2021
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
Hi all,
I have a question about a data sheet I have to edit. For a company, I receive data from a machine each day. That data has to be calculated to other values, and after each month I need the totals of these data. I want to create a VBA-code, so that each time they upload the data, I can put in the code and it will automatically calculate the values and the sum after each month. This has to be done per machine in a sheet (so I have multiple sheets per Excel-document of different machines who all have different data).
Since I cannot/may not share the data, I made a sheet with fictive data to try. I really have no idea how to start with the code.
So: I have raw data (value 1-value 4, first table) of each day of the month. I need to calculate data from this (value 5, 6, 7) and I need a sum/mean of these values (second table) with two blank rows in between.
I hope this is a clear question, and I created a XLB22 add-in. Thanks in advance.
Fictive "raw" data
Disired end result
I have a question about a data sheet I have to edit. For a company, I receive data from a machine each day. That data has to be calculated to other values, and after each month I need the totals of these data. I want to create a VBA-code, so that each time they upload the data, I can put in the code and it will automatically calculate the values and the sum after each month. This has to be done per machine in a sheet (so I have multiple sheets per Excel-document of different machines who all have different data).
Since I cannot/may not share the data, I made a sheet with fictive data to try. I really have no idea how to start with the code.
So: I have raw data (value 1-value 4, first table) of each day of the month. I need to calculate data from this (value 5, 6, 7) and I need a sum/mean of these values (second table) with two blank rows in between.
I hope this is a clear question, and I created a XLB22 add-in. Thanks in advance.
Fictive "raw" data
Test Inv.xlsx | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Date | Value 1 | Value 2 | Value 3 | Value 4 | ||
2 | 11-10-2021 00:00 | 564845 | 496973 | 215486 | 399187 | ||
3 | 10-10-2021 00:00 | 534654 | 470410 | 541354 | 377851 | ||
4 | 9-10-2021 00:00 | 454845 | 400191 | 545122 | 321448 | ||
5 | 8-10-2021 00:00 | 241613 | 212581 | 154565 | 170753 | ||
6 | 7-10-2021 00:00 | 214526 | 188749 | 215553 | 151610 | ||
7 | 6-10-2021 00:00 | 545612 | 480051 | 545452 | 385595 | ||
8 | 5-10-2021 00:00 | 654848 | 576161 | 153315 | 462794 | ||
9 | 4-10-2021 00:00 | 989563 | 870657 | 215345 | 699344 | ||
10 | 3-10-2021 00:00 | 325485 | 286375 | 215656 | 230027 | ||
11 | 2-10-2021 00:00 | 565495 | 497545 | 844664 | 399647 | ||
12 | 1-10-2021 00:00 | 456123 | 401315 | 546545 | 322351 | ||
13 | 30-9-2021 00:00 | 845612 | 845615 | 248426 | 985642 | ||
14 | 29-9-2021 00:00 | 545643 | 546225 | 154564 | 235133 | ||
15 | 28-9-2021 00:00 | 545621 | 584456 | 321521 | 658412 | ||
16 | 27-9-2021 00:00 | 656412 | 564865 | 212021 | 231515 | ||
17 | 26-9-2021 00:00 | 214132 | 564546 | 212312 | 215315 | ||
Sheet1 |
Disired end result
Test Inv.xlsx | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | Date | Value 1 | Value 2 | Value 3 | Value 4 | Value 5 | Value 6 | Value 7 | ||
2 | 11-10-2021 00:00 | 564845 | 496973 | 215486 | 399187 | 15.69 | 19.79 | 0.79 | ||
3 | 10-10-2021 00:00 | 534654 | 470410 | 541354 | 377851 | 14.85 | 28.10 | 0.53 | ||
4 | 9-10-2021 00:00 | 454845 | 400191 | 545122 | 321448 | 12.63 | 26.26 | 0.48 | ||
5 | 8-10-2021 00:00 | 241613 | 212581 | 154565 | 170753 | 6.71 | 10.20 | 0.66 | ||
6 | 7-10-2021 00:00 | 214526 | 188749 | 215553 | 151610 | 5.96 | 11.23 | 0.53 | ||
7 | 6-10-2021 00:00 | 545612 | 480051 | 545452 | 385595 | 15.16 | 28.49 | 0.53 | ||
8 | 5-10-2021 00:00 | 654848 | 576161 | 153315 | 462794 | 18.19 | 20.26 | 0.90 | ||
9 | 4-10-2021 00:00 | 989563 | 870657 | 215345 | 699344 | 27.49 | 30.17 | 0.91 | ||
10 | 3-10-2021 00:00 | 325485 | 286375 | 215656 | 230027 | 9.04 | 13.95 | 0.65 | ||
11 | 2-10-2021 00:00 | 565495 | 497545 | 844664 | 399647 | 15.71 | 37.28 | 0.42 | ||
12 | 1-10-2021 00:00 | 456123 | 401315 | 546545 | 322351 | 12.67 | 26.33 | 0.48 | ||
13 | ||||||||||
14 | oct 2021 | 154.10 | 252.06 | 0.61 | ||||||
15 | ||||||||||
16 | 30-9-2021 00:00 | 845612 | 845615 | 248426 | 985642 | 23.49 | 30.39 | 0.77 | ||
17 | 29-9-2021 00:00 | 545643 | 546225 | 154564 | 235133 | 15.16 | 19.47 | 0.78 | ||
18 | 28-9-2021 00:00 | 545621 | 584456 | 321521 | 658412 | 15.16 | 25.17 | 0.60 | ||
19 | 27-9-2021 00:00 | 656412 | 564865 | 212021 | 231515 | 18.23 | 21.58 | 0.84 | ||
20 | 26-9-2021 00:00 | 214132 | 564546 | 212312 | 215315 | 5.95 | 21.58 | 0.28 | ||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F2:F12 | F2 | =[@[Value 1]]/36000 |
G2:G12 | G2 | =SUM(C2,D2)/36000 |
H2:H12,H14 | H2 | =[@[Value 5]]/[@[Value 6]] |
F14:G14 | F14 | =SUM(F2:F12) |
F16:F20 | F16 | =B16/36000 |
G16:G20 | G16 | =SUM(C16:D16)/36000 |
H16:H20 | H16 | =F16/G16 |