title: Continuously Subtracting value with some conditions
body: <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time     Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41
   1330        01867       4                  56           39
   1330        01868       5        H3        50           39
   1330        01869       6        H1        43           41
   1330        01870       7                  39           40
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>Hello everyone, this problem is stuck in my head in the past few weeks and i decide to ask now, this is not that simple for me. Im going to calculate the process standard time.</p>
  
  <p>Here is the story, i did this one manually until now, the condition is : </p>
  
  <p>Code start with H3 or A3, start time is 78
  Other code or empty data, start time is 68</p>
  
  <p>We calculate standard per Man.No, for example, at Man.No = 1330, sequence is from 1 until 7, for sequence number 7 at Man.No 1330, the code is blank, the standard will be <strong>68</strong> (FYI : The sequence number is varuious, it could be 7, 12, 8, or maybe 2, depends on the situation)</p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41
   1330        01867       4                  56           39
   1330        01868       5        H3        50           39
   1330        01869       6        H1        43           41
   1330        01870       7                  39           40             68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>After that, to calculate the sequence number 6 with H1 code which have to start with 68', we have to calculate it with this formula :
  advance standard (68)+(45-(Average of Process2Time at current Man.No)) so it will be (68)+(45-((43+39+41+39+39+41+40)/7))) = 68+(45-40.3) = 68+4.7 = <strong>72.7</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time     Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41
   1330        01867       4                  56           39                
   1330        01868       5        H3        50           39          
   1330        01869       6        H1        43           41           72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
  </code></pre>
  
  <p>1331        01875       5        H2A       44           38</p>
  
  <p>After that, to calculate the sequence number 5 with H3 code which have to start with 78' as i said before because it need more time (10') to process product, we have to calculate it with this formula : advance standard (72.7)+(45-(Average of Process2Time at current Man.No)<strong>+10</strong>). So it will be : (72.7)+(45-((43+39+41+39+39+41+40)/7)))<strong>+10</strong> = 72.7+(45-40.3)+10 = 72.7+4.7+10 = <strong>87.4</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41
   1330        01867       4                  56           39                
   1330        01868       5        H3        50           39           87.4
   1330        01869       6        H1        43           41           72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>After that, to calculate the sequence number 4 with blank code which have to start with 68', we have to calculate it with this formula : advance standard (87.4)+(45-(Average of Process2Time at current Man.No)). So it will be : (87.4)+(45-((43+39+41+39+39+41+40)/7)))= 87.4+(45-40.3) = 87.4+4.7 = <strong>92.1</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41
   1330        01867       4                  56           39           92.1 
   1330        01868       5        H3        50           39           87.4
   1330        01869       6        H1        43           41           72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>continue with sequence 3 with H1 code, so we just need to plus 4,7 which is 92.1+4.7 = <strong>96.8</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39
   1330        01866       3        H1        72           41           96.8
   1330        01867       4                  56           39           92.1 
   1330        01868       5        H3        50           39           87.4
   1330        01869       6        H1        43           41           72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>after that continue with sequence no 2 with H3 Code, remember, need +10. so it will be 96.8+4.7+10 = <strong>111.5</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   Standard
   1330        01864       1        H3       113           43
   1330        01865       2        H3        97           39           111.5
   1330        01866       3        H1        72           41          96.8
   1330        01867       4                  56           39          92.1 
   1330        01868       5        H3        50           39          87.4
   1330        01869       6        H1        43           41          72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>So finally we go to the first sequence, it will be not add +10 because the sequence 2 is also H3/A3 which need same time to process, so we just need to calculate, 111.5+4.7 = <strong>116.2</strong></p>
  
  <pre><code>Man.No     ProdNumber     Sequence   Code    Process1Time   Process2Time   Standard
   1330        01864       1        H3       113           43           116.2
   1330        01865       2        H3        97           39           111.5
   1330        01866       3        H1        72           41           96.8
   1330        01867       4                  56           39           92.1 
   1330        01868       5        H3        50           39           87.4
   1330        01869       6        H1        43           41           72.7
   1330        01870       7                  39           40           68
   1331        01871       1        H2A       64           42
   1331        01872       2        H2A       56           41
   1331        01873       3        H2A       53           41
   1331        01874       4        H2A       49           39
   1331        01875       5        H2A       44           38
  </code></pre>
  
  <p>Thats all, its so horrible for me, thats why i would like to ask here, and if you think that i explain this matter too complicated, well i dont think so, because this is the simplest way to explain this horrible thing. will be so grateful if someone can help.</p>
  
  <p>Thank you so much!</p>