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

[µo°Ý] &·Ð½Ð«ü¾Éµ{¦¡½X¸ÑÄÀªº·N«ä~~~

[µo°Ý] &·Ð½Ð«ü¾Éµ{¦¡½X¸ÑÄÀªº·N«ä~~~

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-13 16:27 ½s¿è

Set d = CreateObject("Scripting.Dictionary")
<----¬Ý¤£À´,Áö¦³«ö"f1"¬dCreateObjectªº¸ÑÄÀ..¦ýÁÙ¬O¬Ý¤£À´,¥t¥~Scripting.Dictionary¬O¤°»ò·N«ä
With Sheet1
d(.[A1] & .[B1]) = .[C1]<----¤£À´d(.[A1] & .[B1]) ³o­Ó¼gªkªº·N«ä~~~
For Each a In .Range(.[A2], .[A65536].End(xlUp))
   d(a & a.Offset(, 1)) = d(a & a.Offset(, 1)) + a.Offset(, 2)<----¤£À´d(a & a.Offset(, 1)) ³o­Ó¼gªkªº·N«ä~~~
Next
End With
With Sheet2
.Columns("A:B") = ""
.[A1].Resize(d.Count, 1) = Application.Transpose(d.keys)
.[B1].Resize(d.Count, 1) = Application.Transpose(d.items)
<----Transpose(d.keys)»PTranspose(d.items)¬O¤°»ò·N«ä
End With

¥i¥H»¡¤@¤U SHEET1 ªº A, B, C 3Äæ¬O¤°»ò¶Ü

¦pªG³]¤@­Ó¨Òªº¸Ü
AÄæ¬OµP¤l, BÄæ¬O³f¦W, C¬O¥ó¼Æ

°²³]sheet1¬O
        A      B     C
1  µP¤l  ³f¦W  ¥ó¼Æ
2  A      Z     1
3  A      Y     2
4  B      X     3
5  A      Z     4

¹B¦æ«ásheet2:
     A             B
1  µP¤l³f¦W  ¥ó¼Æ
2  AZ            5
3  AY            2
4  BX            3

¦r¨åª«¥ó¥i¥H¬Ý¦¨¬O¤@­Ó¿W¥ßÁôÂêºexcel­¶,¤W­±¥u¦³key(Áä)©Mitem(­È)¨â­ÓÄæ¦ì
¦p
d("M")=1 -> §âMÁ䪺­È³]¦¨¼Æ¦r1
d("N")="c" ->§âNÁ䦳ªº­È³]¦¨¦r"c"
¤W­±¨â¦æ·|²£¥Í¤U­±4­Ó"®æ¤l"
M    1
N    c


¦³Ãö¤W­±¥N½X·N«ä
d(.[A1] & .[B1]) = .[C1]  
´N¬O§â"µP¤l³f¦W"Á䪺­È³]¦¨c1ªº¥ó¼Æ

¸ò³o¼Ë¼g¤@¼Ë
d("µP¤l" & "³f¦W") = "¥ó¼Æ"  


d(a & a.Offset(, 1)) = d(a & a.Offset(, 1)) + a.Offset(, 2)
´N¬O§â¨C¤@¦æªº µP¤l/³f¦W Áä ¥[¤WcÄ檺­È

a¬OaÄæ "¥Ña2¦ÜaÄæ³Ì«á¤@­Ó®æ" ªº¨ä¤¤¤@­Ó®æ¤l  
a.Offset(, 1)¬Oa«á1Ä檺®æ¤l (§Y¬O¦P¦CbÄæ)
§Y¬O
d("AZ")=d("AZ")+1
d("AY")=d("AY")+2
d("BX")=d("BX")+3
d("AZ")=d("AZ")+4

¨C¤@¦æ¹B¤@¤U:
d("AZ")=0+1
d("AY")=0+2
d("BX")=0+3
d("AZ")=1+4  (¦]¬°¤§«e d("AZ")¤w¥X²{,¦Ó¥B­È¬°1,©Ò¥H©â¥X­ì¨Óªº­È¦A¥[¤W)


³Ì«á¥Î
.[A1].Resize(d.Count, 1) = Application.Transpose(d.keys)
.[B1].Resize(d.Count, 1) = Application.Transpose(d.items)
¤À§O§â
©Ò¦³Áä¥ÑEXCEL¤WA1¶}©l¦V¤U¦C¥X
©M
©Ò¦³­È¥ÑEXCEL¤WB1¶}©l¦V¤U¦C¥X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¦^´_ 2# oobird
µo²{¦³ªºµ{¦¡½X¨S§¹¾ãÅã¥Ü
¦Apo¤@¦¸

    Set d = CreateObject("Scripting.Dictionary")
With Sheet1
d(.[A1] & .[B1]) = .[C1]
For Each a In .Range(.[A2], .[A65536].End(xlUp))
   d(a & a.Offset(, 1)) = d(a & a.Offset(, 1)) + a.Offset(, 2)
Next
End With
With Sheet2
.Columns("A:B") = ""
.[A1].Resize(d.Count, 1) = Application.Transpose(d.keys)
.[B1].Resize(d.Count, 1) = Application.Transpose(d.items)
End With

TOP

Set d = CreateObject("Scripting.Dictionary")
½Õ¥Î¦r¨åª«¥ó
d(.[A1] .[B1]) = .[C1]<----³o¬O¿ù»~ªº¼gªk
d(a a.Offset(, 1)) = ...<----³o¦æ¤]¬O¿ù»~ªº
­Y¬O¦X¦}¨â­ÓÀx¦s®æÀ³¸Ó¥Î"&"²Å¸¹³s°_¨Ó¡I

TOP

        ÀR«ä¦Û¦b : §Ñ¥\¤£§Ñ¹L¡A§Ñ«è¤£§Ñ®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD