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

[µo°Ý] ¨ç¼Æ´£¤É¬°¥N½X

[µo°Ý] ¨ç¼Æ´£¤É¬°¥N½X

excelªº«e½ú­Ì
¤u§@ªí Sheet2  B , C , O , P Äæ³]¦³¨ç¼Æ , ¥i¥H§â¥¦­Ì¥Hµ{¦¡¥N½Xªº¤è¦¡³B²z¶Ü ?
BÄæ³]¨ç¼Æ¦p¤U
=IF(A2<> "",VLOOKUP($A$2:$A$409,¸ê®Æ!$A$1:$C$64,2,FALSE), "")
CÄæ³]¨ç¼Æ¦p¤U
=IF(B2<> "",VLOOKUP($A$2:$A$409,¸ê®Æ!$A$1:$C$64,3,FALSE), "")
OÄæ³]¨ç¼Æ¦p¤U
=IF(AND(COUNTIF($A$2:$A2,$A2)=1,SUMIF($A$2:$A$301,$A2,$D$2)),SUMIF($A$2:$A$301,$A2,$D$2),"")
PÄæ³]¨ç¼Æ¦p¤U
=IF(AND(COUNTIF($E$2:$E2,$E2)=1,SUMIF($E$2:$E$301,$E2,$D$2)),SUMIF($E$2:$E$301,$E2,$D$2),"")

ÁÂÁÂ
µL¤îºÉªº§V¤O¤W¶i

dear sir-
©ó¦¹ºô¯¸°õ¦æ"·j¯Á" key ÃöÁä¦r "VLOOKUP" "COUNTIF" "SUMIF"
·|¦³³\¦hvba½d¨Ò¨Ñ°Ñ¦Ò¨Ï¥Î.
ù

TOP

¥»©«³Ì«á¥Ñ yen956 ©ó 2016-3-7 18:24 ½s¿è

³q±`³oºØ±¡§Î§Ú·|¥Î¿ý»sªº,

1. [B2]¿é¤J¤½¦¡:
=IF(A2<> "",VLOOKUP($A$2:$A$409,¸ê®Æ!$A$1:$C$64,2,FALSE), "")
2. ¿ý»s¥¨¶°
3. ¦b¤½¦¡¤¤¶¡ªºªÅ¥Õ³B¦A¥[¤@ªÅ¥Õ(¤£·|¼vÂQ¤½¦¡ªº¹B§@)
4. °±¤î¿ý»s¥¨¶°
¦p¦¹´NÀò±oVBAªº¤½¦¡, ¦p¤U:
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[-1]<>  """",VLOOKUP(R2C1:R409C1,¸ê®Æ!R1C1:R64C3,2,FALSE), """")"
¦A­×¬°
    [B2].FormulaR1C1 = _
        "=IF(RC[-1]<>  """",VLOOKUP(R2C1:R409C1,¸ê®Æ!R1C1:R64C3,2,FALSE), """")"
§Y¥i,
·íµM¯u¥¿°ª¤â¥i¯à¤£¥²¦p¦¹, ¦ý§Ú¤@¦V¦p¦¹¼gVBA¤½¦¡.
¸Õ¸Õ¬Ý!!

TOP

¦^´_ 1# vinejason


    ¶â¡I§Ú¤£¬O«ÜÀ´¨ç¼Æ¡A©Ò¥H¥u¯à¦^µª³¡¥÷
¥­±`­Y¹J¨ì³o°ÝÃD¡A§Ú¤j¦h¼Æ¬O¥H¤u§@ªí¨Æ¥ó¥h°µ¡A¥H¤Uµ¹§A°Ñ¦Ò¡A¤£¹L§Ú¥u°µ¨ìVLOOKUP³¡¥÷
¥t2­Ó¡A¨þ¨þ¡I ¤£À´¡C¥H¤Uµ¹§A°Ñ¦Ò
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2.     Dim Rng As Range, c As Range
  3.     For Each Rng In Target
  4.         If Rng.Column = 1 Then
  5.             If Rng <> "" Then
  6.                 With Sheets("¸ê®Æ")
  7.                     Set c = .Columns(1).Find(Rng.Value, LookIn:=xlValues, LookAt:=xlWhole)
  8.                     If Not c Is Nothing Then
  9.                         Application.EnableEvents = False
  10.                         Rng.Offset(, 1) = c.Offset(, 1) 'BÄæ
  11.                         Rng.Offset(, 2) = c.Offset(, 2) 'cÄæ
  12.                         Application.EnableEvents = True
  13.                     End If
  14.                 End With
  15.             Else
  16.                 Rng.Offset(, 1) = "" 'BÄæ
  17.                 Rng.Offset(, 2) = "" 'cÄæ
  18.             End If
  19.         End If
  20.     Next
  21. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# vinejason

Sub ex()

    With Sheets("Sheet2")
        'BÄæ³]¨ç¼Æ¦p¤U
        '=IF(A2<> "",VLOOKUP($A$2:$A$409,¸ê®Æ!$A$1:$C$64,2,FALSE), "")
        Range("B2:B409") = "=IF(A2<> """",VLOOKUP($A2,¸ê®Æ!$A$1:$C$64,2,FALSE), """")" '»P­ì¦¡²¤¦³¤£¦P
'        Range("B2:B409") = Range("B2:B409").Value '¤½¦¡Âର­È
        
        'CÄæ³]¨ç¼Æ¦p¤U
        '=IF(B2<> "",VLOOKUP($A$2:$A$409,¸ê®Æ!$A$1:$C$64,3,FALSE), "")
        Range("C2:C409") = "=IF(B2<> """",VLOOKUP($A2,¸ê®Æ!$A$1:$C$64,3,FALSE), """")" '»P­ì¦¡²¤¦³¤£¦P
'        Range("C2:C409") = Range("C2:C409").Value '¤½¦¡Âର­È

        'OÄæ³]¨ç¼Æ¦p¤U
        '=IF(AND(COUNTIF($A$2:$A2,$A2)=1,SUMIF($A$2:$A$301,$A2,$D$2)),SUMIF($A$2:$A$301,$A2,$D$2),"")
        Range("O2:O409") = "=IF(AND(COUNTIF($A$2:$A2,$A2)=1,SUMIF($A$2:$A$301,$A2,$D$2)),SUMIF($A$2:$A$301,$A2,$D$2),"""")"
'        Range("O2:O409") = Range("O2:O409").Value '¤½¦¡Âର­È

        'PÄæ³]¨ç¼Æ¦p¤U
        '=IF(AND(COUNTIF($E$2:$E2,$E2)=1,SUMIF($E$2:$E$301,$E2,$D$2)),SUMIF($E$2:$E$301,$E2,$D$2),"")
        Range("P2:P409") = "=IF(AND(COUNTIF($E$2:$E2,$E2)=1,SUMIF($E$2:$E$301,$E2,$D$2)),SUMIF($E$2:$E$301,$E2,$D$2),"""")"
'        Range("P2:P409") = Range("P2:P409").Value '¤½¦¡Âର­È

    End With

End Sub
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 3# yen956

ÁÂÁ´£¨Ñ¦n¤èªk
¤S¾Ç·|¤@©Û
µL¤îºÉªº§V¤O¤W¶i

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD