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

[µo°Ý] ¤£³W«h¤å¦r,¨ú¼Æ¦rÅçºâ

C3{=SUM(RIGHT(SMALL(IFERROR(MID(A3,SMALL(IF(MID(A3,ROW($1:$199),1)="-",ROW($1:$199)),ROW($1:$19))+MATCH(,0/MID(A3,FIND("-",A3)+ROW($1:$9),1),),{1,2,3})*1,)+ROW($1:$19)/1%%,ROW($1:$19)*3),4)-RIGHT(SMALL(IFERROR(MID(A3,SMALL(IF(MID(A3,ROW($1:$199),1)="-",ROW($1:$199)),ROW($1:$19))-{1,2,3},{1,2,3})*1,)+ROW($1:$19)/1%%,ROW($1:$19)*3),4))+LEN(A3)-LEN(SUBSTITUTE(A3,",",))+1

11311.png (20.52 KB)

11311.png

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 3# PJChen


    ÁÂÁ«e½ú¦^´_,¤@°_¾Ç²ß,ÁÂÁ½׾Â,Á¦U¦ì«e½ú
«á¾ÇÂdzo©«½Æ²ß¬Q¤Ñªº¤è®×,¤è®×¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú°Ñ¦Ò,½Ð¦U¦ì«e½ú«ü±Ð

Option Explicit
Sub TEST()
Dim Brr, V, i, j&, Z&, xR As Range
'¡ô«Å§iÅܼÆ:(Brr,V,i)¬O³q¥Î«¬ÅܼÆ,(j,Z)¬Oªø¾ã¼Æ,xR¬OÀx¦s®æÅܼÆ
Set xR = Range([A17], Cells(Rows.Count, "A").End(xlUp)): Brr = xR
'¡ô¥OxR³oÀx¦s®æÅܼƬO [A17]¨ì AÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ,
'¥OBrr³o³q¥Î«¬ÅܼƬO ¤Gºû°}¦C,¥HxRÅܼÆ(Àx¦s®æ)­È±a¤J

With xR.Offset(0, 1)
'¡ô¥H¤U¬OÃö©óxRÅܼƦV¥k°¾²¾¤@Ä檺µ{§Ç
   .Value = Brr
   '¡ô¥O¨äÀx¦s®æ­È¬O Brr°}¦C­È
   For Each i In Array("*(", ")*", " "): .Replace i, "", 2: Next
   '¡ô³]³v¶µ°j°é,¥Oi³o³q¥Î«¬ÅܼƬO ¤@ºû°}¦C¤¤ªº¤@­Ó¦r¦ê
   '¥O¸Ó½d³òÀx¦s®æ°µ¦r¤¸¸m´«,¥ý±N¥ª¬A©·"(" ¥ªÃ䪺¦r¤¸³£´«¦¨ªÅ¦r¤¸
   '¦A±N¥k¬A©·")" ¥kÃ䪺¦r¤¸³£´«¦¨ªÅ¦r¤¸
   '³Ì«á±NªÅ¥Õ¦r¤¸³£´«¦¨ªÅ¦r¤¸

   For i = 65 To 122: .Replace Chr(i), "", 2: Next
   '¡ô³]¶¶°j°é!i±q65 ¨ì122
   '¥O¸Ó½d³òÀx¦s®æ°µ¦r¤¸¸m´«±qA,B,C,D....°µ¸m´«¦¨ªÅ¦r¤¸,Chr(65)="A"
   ', 2¬O«üÀx¦s®æ¸Ì¦r¦ê³¡¤À¬Û¦P´N°µ¸m´«,¤£»Ý­n¦r¦ê¥þ³¡¬Û¦P¤~¸m´«

   Brr = .Value
   '¡ô¥OBrr³o³q¥Î«¬Åܼƴ«¸Ë¤W­z³o¨Ç°j°éªºÀx¦s®æµ²ªG­È
End With
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1 ¨ìBrrÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
   V = Split(Brr(i, 1), ",")
   '¡ô¥OV³o³q¥Î«¬ÅܼƬO¤@ºû°}¦C,¥Hi°j°é¦C1ÄæBrr°}¦C­È³Q","¤À³Î«áªº­È
   For j = 0 To UBound(V)
   '¡ô³]¶¶°j°é!j±q0 ¨ìV°}¦C³Ì¤j¯Á¤Þ¸¹¼Æ
      If InStr(V(j), "-") Then
      '¡ô¦pªGj°j°éV°}¦C­È¥]§t"-"²Å¸¹??
         Z = Z + Abs(Evaluate("=" & V(j))) + 1
         '¡ô´N¥OZ³oªø¾ã¼ÆÅܼƬO ¦Û¨­ + ­pºâ­È
         '­pºâ­È:j°j°éV°}¦C­È¦b«e­±¥[­Ó"="¤§«á°µ¹Bºâ
         '¨Ò¦p:Evaluate("=2-14") =-12
         'Abs(-12)=12 :¬Oµ´¹ï­È,Åý­È³£ÅÜ¥¿¼Æªº·N«ä,
         '³Ì«á«ö·Ó½d¨Ò·N¸q +1

         ElseIf V(j) <> "" Then
         '¡ô§_«h¦pªGj°j°éV°}¦C­È¤£¬OªÅ¦r¤¸?
            Z = Z + 1
            '¡ô´N¥OZÅܼƲ֥[ 1
      End If
   Next
   Brr(i, 1) = Z: Z = 0
   '¡ô¥Oi°j°é¦C²Ä1ÄæBrr°}¦C­È¬O ÅܼÆZ,
   '¡ô¥OZÅܼƬO 0 (¦]¬°­n¶]iªº¤U¤@­Ó°j°é¤F,©Ò¥H­nÅýZÂk¹s­«ºâ)

Next
xR.Offset(0, 1) = Brr
'¡ô¥OxRÅܼƦV¥k°¾²¾¤@Äæ,³o½d³òÀx¦s®æ­È¥HBrr°}¦C­È±a¤J
Set xR = Nothing: Erase Brr, V
'¡ô¥OÄÀ©ñ³o¨ÇÅܼÆ
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ PJChen ©ó 2023-4-17 16:45 ½s¿è

¦^´_ 2# Andy2483


·PÁÂ,
³o­Óµ{¦¡¤Ó¯«©_¤F,¤£¦Pªº²Õ¦X³£¥i¥Hºâ±o¥X¨Ó~~


½Ð°Ý³o¬q¯àÀ°§Ú¸Ñ»¡¤@¤U¶Ü?
For i = 65 To 122: .Replace Chr(i), "", 2: Next

TOP

¦^´_ 1# PJChen


    ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«½m²ß°}¦C,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò

°õ¦æ«e:


°õ¦æµ²ªG:



Option Explicit
Sub TEST()
Dim Brr, V, Z&, i, j&, xR As Range
Set xR = Range([A17], Cells(Rows.Count, "A").End(xlUp)): Brr = xR
With xR.Offset(0, 1)
   .Value = Brr
   For Each i In Array("*(", ")*", " "): .Replace i, "", 2: Next
   For i = 65 To 122: .Replace Chr(i), "", 2: Next
   Brr = .Value
End With
For i = 1 To UBound(Brr)
   V = Split(Brr(i, 1), ",")
   For j = 0 To UBound(V)
      If InStr(V(j), "-") Then
         Z = Z + Abs(Evaluate("=" & V(j))) + 1
         ElseIf V(j) <> "" Then
            Z = Z + 1
      End If
   Next
   Brr(i, 1) = Z: Z = 0
Next
xR.Offset(0, 1) = Brr
Set xR = Nothing: Erase Brr, V
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ±o²z­nÄǤH¡A²zª½­n®ð©M¡C
ªð¦^¦Cªí ¤W¤@¥DÃD