Total numeric values for any given date

lazzareo

New Member
Joined
Oct 13, 2009
Messages
28
Hi,

I have a basic spreadsheet with 4 columns of data:


  • Column A contains a date
  • Column D contains a numeric value

I want to run a macro/query that outputs the total numeric values for any given date.

e.g.

Week CommencingName LocationDays
02 January 2017anonymousLondon4
02 January 2017anonymousLondon4
02 January 2017anonymousLondon2
02 January 2017anonymousLondon4
09 January 2017anonymousLondon3
09 January 2017anonymousLondon4
09 January 2017anonymousLondon2
09 January 2017anonymousLondon2
16 January 2017anonymousLondon5
16 January 2017anonymousLondon2
16 January 2017anonymousLondon5
16 January 2017anonymousLondon4

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


How could I do this?

Thanks.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi, maybe you could consider a formula:


Excel 2013/2016
ABCDEFG
1Week CommencingNameLocationDaysGiven DayTotal
202 January 2017anonymousLondon409 January 201711
302 January 2017anonymousLondon4
402 January 2017anonymousLondon2
502 January 2017anonymousLondon4
609 January 2017anonymousLondon3
709 January 2017anonymousLondon4
809 January 2017anonymousLondon2
909 January 2017anonymousLondon2
1016 January 2017anonymousLondon5
1116 January 2017anonymousLondon2
1216 January 2017anonymousLondon5
1316 January 2017anonymousLondon4
ALLCOMPS
Cell Formulas
RangeFormula
G2=SUMIFS(D:D,A:A,F2)
 
Upvote 0
Try this for results starting "G1":-
Code:
[COLOR="Navy"]Sub[/COLOR] MG20Nov31
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Dt [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), 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
    Dt = CDbl(DateValue(Dn.Value))
    [COLOR="Navy"]If[/COLOR] Not .Exists(Dt) [COLOR="Navy"]Then[/COLOR]
        .Add Dt, Dn.Offset(, 3).Value
    [COLOR="Navy"]Else[/COLOR]
        .Item(Dt) = .Item(Dt) + Dn.Offset(, 3)
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
Range("G1").Resize(.Count, 2).Value = Application.Transpose(Array(.Keys, .items))
Range("G1").Resize(.Count).NumberFormat = "dd-mmm-yy"
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,528
Messages
6,120,065
Members
448,942
Latest member
sharmarick

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