Hi,
I have a continuously (once a day) updating database that looks like this:
[TABLE="width: 1600"]
<colgroup><col><col span="5"><col span="6"><col><col span="12"></colgroup><tbody>[TR]
[TD="align: left"]Machine[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]`[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]Minor Stops[/TD]
[TD="align: left"]Malfunction[/TD]
[TD="colspan: 2, align: left"]Malfunction Type[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]Minor Stops[/TD]
[TD="align: left"]Malfunction[/TD]
[TD="colspan: 2, align: left"]Malfunction Type[/TD]
[/TR]
[TR]
[TD="align: left"]1A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2.8[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]2A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]3A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]4A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]1B[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]2B[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]5B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]6B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]7B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]8B[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.8[/TD]
[TD="align: right"]0.9[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.6[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]1.6[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.8[/TD]
[TD="align: right"]0.9[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.6[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]1.6[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]9B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
I am trying to create a loop that will give me the summary of machine malfunctions by type.
Assume that the database is full and based on the following logic:
1. The first cell in the row is the machine number/ name
2. Each shift is 8 hours long.
3. For each shift theres an indication per hour of machine utilization:
a. First 8 cells are the machine operating capacity (Number between 0 to 1).
b. The next cell (9th) is minor stoppages (the amount of hours the machine did not work at full capacity, usually a fracture. E.g. 1 in the second row, or 1.6 in machine 8B).
c. Alternatively if the machine experienced a malfunction the 10th cell will sum the number of idle hours the machine stood idle, and the 11th cell will specify the reason (from a closed list of reasons).
4. These 11 cells will repeat themselves for every shift
5. Some machines appear twice (1A 1B) but only one of them is relevant, next to other it states dual use so to know that the machine was not idle but used in another line
I want the loop to create the following summary table:
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64, align: left"]1A[/TD]
[TD="width: 64, align: left"]A[/TD]
[TD="width: 64, align: right"]2.8[/TD]
[/TR]
[TR]
[TD="align: left"]2A[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: left"]3A[/TD]
[TD="align: left"]A[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]B[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: left"]4A[/TD]
[TD="align: left"]B[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="align: left"]1B[/TD]
[TD="colspan: 2, align: left"]DUAL USE[/TD]
[/TR]
[TR]
[TD="align: left"]2B[/TD]
[TD="colspan: 2, align: left"]DUAL USE[/TD]
[/TR]
[TR]
[TD="align: left"]5B[/TD]
[TD="align: left"](none)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: left"]6B[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: left"]7B[/TD]
[TD="align: left"]A[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: left"]8B[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]3.2[/TD]
[/TR]
[TR]
[TD="align: left"]9B[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Ive tried any pivotable or multiple Ifs I can think of.
Thank you so much!
I have a continuously (once a day) updating database that looks like this:
[TABLE="width: 1600"]
<colgroup><col><col span="5"><col span="6"><col><col span="12"></colgroup><tbody>[TR]
[TD="align: left"]Machine[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]`[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]Minor Stops[/TD]
[TD="align: left"]Malfunction[/TD]
[TD="colspan: 2, align: left"]Malfunction Type[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: left"]Minor Stops[/TD]
[TD="align: left"]Malfunction[/TD]
[TD="colspan: 2, align: left"]Malfunction Type[/TD]
[/TR]
[TR]
[TD="align: left"]1A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2.8[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]2A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]3A[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]4A[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]
[TD="align: left"]B[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]1B[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]2B[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: left"]Dual use[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]5B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]6B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]7B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: left"]A[/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]8B[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.8[/TD]
[TD="align: right"]0.9[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.6[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]1.6[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.8[/TD]
[TD="align: right"]0.9[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]0.6[/TD]
[TD="align: right"]0.7[/TD]
[TD="align: right"]1.6[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: left"]9B[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
I am trying to create a loop that will give me the summary of machine malfunctions by type.
Assume that the database is full and based on the following logic:
1. The first cell in the row is the machine number/ name
2. Each shift is 8 hours long.
3. For each shift theres an indication per hour of machine utilization:
a. First 8 cells are the machine operating capacity (Number between 0 to 1).
b. The next cell (9th) is minor stoppages (the amount of hours the machine did not work at full capacity, usually a fracture. E.g. 1 in the second row, or 1.6 in machine 8B).
c. Alternatively if the machine experienced a malfunction the 10th cell will sum the number of idle hours the machine stood idle, and the 11th cell will specify the reason (from a closed list of reasons).
4. These 11 cells will repeat themselves for every shift
5. Some machines appear twice (1A 1B) but only one of them is relevant, next to other it states dual use so to know that the machine was not idle but used in another line
I want the loop to create the following summary table:
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64, align: left"]1A[/TD]
[TD="width: 64, align: left"]A[/TD]
[TD="width: 64, align: right"]2.8[/TD]
[/TR]
[TR]
[TD="align: left"]2A[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: left"]3A[/TD]
[TD="align: left"]A[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: left"]B[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: left"]4A[/TD]
[TD="align: left"]B[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="align: left"]1B[/TD]
[TD="colspan: 2, align: left"]DUAL USE[/TD]
[/TR]
[TR]
[TD="align: left"]2B[/TD]
[TD="colspan: 2, align: left"]DUAL USE[/TD]
[/TR]
[TR]
[TD="align: left"]5B[/TD]
[TD="align: left"](none)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: left"]6B[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: left"]7B[/TD]
[TD="align: left"]A[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD="align: left"]8B[/TD]
[TD="align: left"]Minor[/TD]
[TD="align: right"]3.2[/TD]
[/TR]
[TR]
[TD="align: left"]9B[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Ive tried any pivotable or multiple Ifs I can think of.
Thank you so much!