# Counting reason loop

Status
Not open for further replies.

#### GexcelG

##### New Member
Hi,

I have a continuously (once a day) updating database that looks like this:
 Machine ` Minor Stops Malfunction Malfunction Type Minor Stops Malfunction Malfunction Type 1A 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0.7 0.5 0 0 2.8 0 A 2A 1 1 1 0.5 1 1 0.5 1 1 0 1 1 1 0.5 1 1 0.5 1 1 0 3A 1 1 1 0 0 1 0 0 0 4 A 1 1 1 1 0 0 0 0 0 4 B 4A 0 0 0 1 1 1 1 1 0 3 B 0 0 0 1 1 1 1 1 0 3 B 1B 0 0 0 0 0 0 0 0 0 0 Dual use 0 0 0 0 0 0 0 0 0 0 Dual use 2B 0 0 0 0 0 0 0 0 0 0 Dual use 0 0 0 0 0 0 0 0 0 0 Dual use 5B 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 6B 1 1 1 0.5 1 1 0.5 1 1 0 1 1 1 0.5 1 1 0.5 1 1 0 7B 1 1 1 0 0 1 0 0 0 4 A 1 1 1 1 1 1 1 1 0 0 8B 0.7 0.8 0.9 1 1 0.7 0.6 0.7 1.6 0 0.7 0.8 0.9 1 1 0.7 0.6 0.7 1.6 0 9B 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0

<colgroup><col><col span="5"><col span="6"><col><col span="12"></colgroup><tbody>
</tbody>
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 there’s 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:

 1A A 2.8 2A Minor 1 3A A 4 B 4 4A B 6 1B DUAL USE 2B DUAL USE 5B (none) 6B Minor 2 7B A 4 8B Minor 3.2 9B

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>

Thank you so much!

#### Fluff

##### MrExcel MVP, Moderator
Duplicated https://www.mrexcel.com/forum/excel-questions/1057165-scan-through-loop.html#post5076217

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it.
Please be patient and do not attempt to post the question again.

Status
Not open for further replies.

1,081,523
Messages
5,359,263
Members
400,523
Latest member
ExcelNewbie98

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...