ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

½Ð°Ý¦U¦ì¦Ñ®v¡A­n¦p¦ó¹ïÀ³¥H¤Uªº¼Æ¶q

½Ð°Ý¦U¦ì¦Ñ®v¡A­n¦p¦ó¹ïÀ³¥H¤Uªº¼Æ¶q

BÄæ¦ì¹ïÀ³AÄæ¦ì¼Æ¶q¥H270¬°³æ¦ì
½Ð°Ý­n¦p¦ó­×§ï¡A¤@­ÈµLªkºâ±oBÄæ¼Æ¶q
  1. Sub to2test()

  2. Dim e&, st$, sb$
  3. st = Cells(1, 4)
  4. sb = Cells(1, 5)
  5. e = [a65536].End(3).Row - 1: If e < 1 Then Exit Sub
  6. For i = 3 To e
  7.    If Cells(i, 1) = "" Then
  8.       Cells(i, 2) = ""
  9.    
  10.     On Error Resume Next
  11.    
  12.     ElseIf Cells(i, 1) < st Then
  13.     Cells(i, 2) = -Int(-Cells(i, 1) / st)
  14.     ElseIf Cells(i, 1) + Cells(i - 2, 1) + Cells(i - 1, 1) > sb Then
  15.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  16.     ElseIf Cells(i, 1) + Cells(i - 2, 1) + Cells(i - 1, 1) = sb Then
  17.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  18.     ElseIf Cells(i, 1) + Cells(i - 2, 1) = sb Then
  19.     Cells(i, 2) = -Int(-Cells(i, 1) / st) - 1
  20.     Else
  21.    
  22.    
  23.     End If
  24. Next

  25. Cells(4, 5) = -Int(-Cells(4, 4) / st)


  26. End Sub
½Æ»s¥N½X

¬¡­¶Ã¯test.rar (11.51 KB)

¦^´_ 1# wsx1130

205 +344+736 = 1285
270 +270 +540 =1080
B11 ¬O¤£¬O­n§ï¬° 3
¦pªG¤£¬OÅ޿謰¦ó?
½Ð½T»{¡AÁÂÁÂ
1.JPG

TOP

¦^´_ 2# samwang

¬¡­¶Ã¯test.rar (13.21 KB)

Sam¡A©êºp¶Ç¿ùÀɮסAÀ³¸Ó¬°ªþ¥ó¡A³W«h¤´¬°1080

TOP

¥»©«³Ì«á¥Ñ samwang ©ó 2022-1-3 07:57 ½s¿è

¦^´_ 3# wsx1130

µª®×¦³°ÝÃD§a?  ±ø¥ó¥i§_¦b¼g¸Ô²Ó¡A·PÁÂ
1.JPG

TOP

¦^´_ 3# wsx1130

3240 / 270 = 12
½Ð¦A½T»{¡AÁÂÁÂ
1.JPG

TOP

¦^´_ 3# wsx1130

819 /270 = 3½c(810)¡A¨S¸Ë½c¦³9­Ó¡A
261 / 270 = 1½c¡A¥i¥H¦b¸Ë¤W9­Ó«e¤@½c

279 / 270 = 2½c(540)¡AÀ³¸Ó 1½c§a? ¦b±N¨S¸Ë½c¦³9­Ó¡A¸Ë¨ì¤U¤@½c

¦n¦h°ÝÃD¡A±ø¥ó¤£¬O«Ü©ú½T¡A½Ð¦A½T»{¡AÁÂÁÂ
1.JPG

TOP

¦^´_ 3# wsx1130

±ø¥ó¥u­n¦³¦h¾l¼Æ¶q´N¥[1½c¡A½d¨Ò»¡©ú¦p¤U¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
819-->4½c¡A1080-819¡AÁÙ¦³261­ÓªÅ¶¡
261 -261 =0½c¡A261­Ó¸É«e¤@½c   

Sub test()
Dim Arr, T%, T1%, Et, i&
T = 270
Arr = Range("a1:b" & [a65536].End(3).Row)
For i = 3 To UBound(Arr)
    If Arr(i, 1) = "" Then GoTo 99
    If Arr(i, 1) >= 1080 Then
        Cells(i, 4) = Application.Round((Arr(i, 1) / T), 0): GoTo 99
    Else
        For i2 = i To UBound(Arr)
            If T1 >= 1080 Then Exit For
            If Arr(i2, 1) <> "" Then T1 = T1 + Arr(i2, 1)
        Next
    End If
    For i3 = i To i2 - 1
        If Arr(i3, 1) = "" Then GoTo 98
        Arr(i3, 1) = Arr(i3, 1) - Et
        Cells(i3, 4) = Application.RoundUp((Arr(i3, 1) / T), 0)
        Et = T * Cells(i3, 4) - Arr(i3, 1)
98: Next
    i = i2 - 1: T1 = 0: Et = 0
99: Next
End Sub

TOP

        ÀR«ä¦Û¦b : ¨Ã«D¦³¿ú¾{¬O§Ö¼Ö¡A°Ý¤ßµL·\¤ß³Ì¦w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD