Multiple reference lookup and output sum of corresponding values

BKB999

New Member
Joined
Apr 3, 2013
Messages
2
languagebatchWCFC
zh1360
id100
vi1360
zh18020
zh14559
zh1400
zh118992
zh1140
id100
vi2140
zh17194
zh1150104
id100
vi2150104
zh120
id100
vi220
zh11226
id100
vi2626
zh120
id100

<colgroup><col><col><col span="2"></colgroup><tbody>
</tbody>

Hi in the above table I need to the sum of WC for each Language code & batch no. eg. for Language "id" & batch 1 I need to get the SUM of WC corresponding to the criteria. Could you please help me in this?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Perhaps this:-
Results start "E1"
Code:
[COLOR="Navy"]Sub[/COLOR] MG03Apr09
[COLOR="Navy"]Dim[/COLOR] Rng     [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Dn      [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Twn     [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    Twn = Dn & " - " & Dn(, 2)
        [COLOR="Navy"]If[/COLOR] Not .Exists(Twn) [COLOR="Navy"]Then[/COLOR]
            .Add Twn, Dn(, 3)
        [COLOR="Navy"]Else[/COLOR]
            .Item(Twn) = .Item(Twn) + Dn(, 3)
        [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Range("E1").Resize(.Count, 2) = Application.Transpose(Array(.Keys, .items))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Perhaps this:-
Results start "E1"
Code:
[COLOR=Navy]Sub[/COLOR] MG03Apr09
[COLOR=Navy]Dim[/COLOR] Rng     [COLOR=Navy]As[/COLOR] Range
[COLOR=Navy]Dim[/COLOR] Dn      [COLOR=Navy]As[/COLOR] Range
[COLOR=Navy]Dim[/COLOR] Twn     [COLOR=Navy]As[/COLOR] [COLOR=Navy]String[/COLOR]
[COLOR=Navy]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR=Navy]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR=Navy]For[/COLOR] [COLOR=Navy]Each[/COLOR] Dn [COLOR=Navy]In[/COLOR] Rng
    Twn = Dn & " - " & Dn(, 2)
        [COLOR=Navy]If[/COLOR] Not .Exists(Twn) [COLOR=Navy]Then[/COLOR]
            .Add Twn, Dn(, 3)
        [COLOR=Navy]Else[/COLOR]
            .Item(Twn) = .Item(Twn) + Dn(, 3)
        [COLOR=Navy]End[/COLOR] If
[COLOR=Navy]Next[/COLOR]
Range("E1").Resize(.Count, 2) = Application.Transpose(Array(.Keys, .items))
[COLOR=Navy]End[/COLOR] With
[COLOR=Navy]End[/COLOR] [COLOR=Navy]Sub[/COLOR]
Regards Mick


Thanks... It worked.

But could you please tell me any other way using formulas? Because in future I need to change this layout so I dont know to edit vba.. thats why..

Thanks for your support
 
Upvote 0

Forum statistics

Threads
1,202,987
Messages
6,052,930
Members
444,616
Latest member
novit19089

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top