maybe vlookup combined with sumifs?

EvaWOL

New Member
Joined
May 31, 2018
Messages
4
Hi,

Please help!
I have a worksheet where in a row I will have a date (column A), a trailer number (column B), a store number (Column C) and a number of loaded cages displayed (Column D).

In column A the same date might be used multiple times. In column G I have a macro running automatically to fetch unique data from this column A every time something added or removed.

Column B (trailer numbers): each day there are 2 different trailer numbers loaded with different stores. These trailer numbers are recorder multiple times as well as each day each trailer has multiple stores loaded on them with different amount of cages.

On the same sheet I have a summary area, starting with column G. Here I have each date displayed only once, and I need to fetch a sum value for the first and the second trailer separately into columns H and I for that day.

E.g.
DateTrailerStoreAmountDateAmount on trl1Amount on trl2
30/05/2018TRL2111430/05/2018need to show 13 for trl21need to show 14 for trl18
30/05/2018TRL2147531/05/2018need to show 23 for trl08need to show 15 for trl65
30/05/2018TRL21744
30/05/2018TRL182111
30/05/2018TRL18183
31/05/2018TRL0899
31/05/2018TRL08368
31/05/2018TRL08246
31/05/2018TRL658514
31/05/2018TRL65161

<tbody>
</tbody>


I've tried so many different things (like =sumifs which works well for the first date but can't modify it for the rest of the data) but nothing seemed to work. I am really not good with VBA, but seems like this is too complex to have any other solution?

If any ideas, can you please spell it out to me as much as possible? I haven't done super complex things with excel before, and defo nothing google could not help me with, so I feel like a noob with this one...

Thank you!
Eva
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Re: maybe vlookup combined with sumifs? is that even possible?

Excel 2010
ABCDEFGHI
1DateTrailerStoreAmountDateAmount on trl1Amount on trl2
25/30/2018TRL211145/30/20181314
35/30/2018TRL214755/31/20182315
45/30/2018TRL21744
55/30/2018TRL182111
65/30/2018TRL18183
75/31/2018TRL0899
85/31/2018TRL08368
95/31/2018TRL08246
105/31/2018TRL658514
115/31/2018TRL65161

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
H2=SUMPRODUCT(($A$2:$A$100=$G2)*($B$2:$B$100="Trl21")*$D$2:$D$100)
I2=SUMPRODUCT(($A$2:$A$100=$G2)*($B$2:$B$100="Trl18")*$D$2:$D$100)
H3=SUMPRODUCT(($A$2:$A$100=$G3)*($B$2:$B$100="Trl08")*$D$2:$D$100)
I3=SUMPRODUCT(($A$2:$A$100=$G3)*($B$2:$B$100="Trl65")*$D$2:$D$100)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Re: maybe vlookup combined with sumifs? is that even possible?

Thank you Jim,

This would be perfect, but the trailer numbers are changing as well, the only constant I can reference to in a formula here is column G. The next trailer might be TRL10 coming in with a different date and store, and I can not possibly predict what will be typed in :(

Is it possible to do?

Thanks
Eva
 
Upvote 0

Book1
ABCDEFGHIJ
1DateTrailerStoreAmountDatetrl21trl18trl08trl65
25/30/2018TRL211145/30/2018131400
35/30/2018TRL214755/31/2018002315
45/30/2018TRL21744
55/30/2018TRL182111
65/30/2018TRL18183
75/31/2018TRL0899
85/31/2018TRL08368
95/31/2018TRL08246
105/31/2018TRL658514
115/31/2018TRL65161
Sheet1


In g2 enter, copy across, and down:

=SUMIFS($D$2:$D$11,$A$2:$A$11,$F2,$B$2:$B$11,G$1)
 
Upvote 0
Thank you for this too. Unfortunately I do not enter the trailer numbers and they only need statistics to see how many we send on each trailer each day. They want the sheet to be filled out by the clerk from column A to D and want the rest to be automatically updated by formulas, fetching the data from A-D.
Going by my example, trl 1 on the 30th is TRL21 and trl 2 is TRL18, next day the numbers for these change.
I am sorry that I can not explain better :(
 
Upvote 0
Thank you for this too. Unfortunately I do not enter the trailer numbers and they only need statistics to see how many we send on each trailer each day. They want the sheet to be filled out by the clerk from column A to D and want the rest to be automatically updated by formulas, fetching the data from A-D.
Going by my example, trl 1 on the 30th is TRL21 and trl 2 is TRL18, next day the numbers for these change.
I am sorry that I can not explain better :(

I don't understand what you are saying. In G1:J1 the user needs to enter the trl specs. Are you saying that should be done by formulas not by user?

Have you considered contructiong a pivot table, which does everything you need here automatically?
 
Upvote 0
If i understand correctly column G is populated by a macro (unique dates). If so, maybe this...


A
B
C
D
E
F
G
H
I
J
K
L
1
Date​
Trailer​
Store​
Amount​
Date​
TRL21​
TRL18​
TRL08​
TRL65​
2
05/30/2018​
TRL21​
11​
4​
05/30/2018​
13​
14​
0​
0​
3
05/30/2018​
TRL21​
47​
5​
05/31/2018​
0​
0​
23​
15​
4
05/30/2018​
TRL21​
74​
4​
5
05/30/2018​
TRL18​
21​
11​
6
05/30/2018​
TRL18​
18​
3​
7
05/31/2018​
TRL08​
9​
9​
8
05/31/2018​
TRL08​
36​
8​
9
05/31/2018​
TRL08​
24​
6​
10
05/31/2018​
TRL65​
85​
14​
11
05/31/2018​
TRL65​
16​
1​
12

<tbody>
</tbody>


Array formula in H1 copied across until you get a blank
=IFERROR(INDEX($B$2:$B$100,SMALL(IF(FREQUENCY(IF($B$2:B$100<>"",MATCH($B$2:$B$100,$B$2:$B$100,0)),ROW($B$2:$B$100)-ROW($B$2)+1),ROW($B$2:$B$100)-ROW($B$2)+1),COLUMNS($H1:H1))),"")
confirmed with Ctrl+Shift+enter, not just Enter

Formula in H2 copied across and down
=IF(H$1="","",SUMIFS($D:$D,$A:$A,$G2,$B:$B,H$1))

M.
 
Last edited:
Upvote 0
Hi,

Never thought of a picot table! Some educational reading just appeared on my to do list!
And no, the users will not touch the statistical part of the sheet, they will only use the first 4 columns to fill in the info. They will have a lot more to record than what I filled in as example, some of them is even a noobier beginner at excel than me, so need to make it as simple and straight forward as possible.
Thank you for all the help and suggestions! :)
 
Upvote 0
Hi,

Never thought of a picot table! Some educational reading just appeared on my to do list!
And no, the users will not touch the statistical part of the sheet, they will only use the first 4 columns to fill in the info. They will have a lot more to record than what I filled in as example, some of them is even a noobier beginner at excel than me, so need to make it as simple and straight forward as possible.
Thank you for all the help and suggestions! :)

The following is something that you would get with a pivot table...


Book1
ABCDEF
14
15Sum of AmountColumn Labels
16Row LabelsTRL08TRL18TRL21TRL65Grand Total
175/30/2018141327
185/31/2018231538
19Grand Total2314131565
20
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,800
Members
449,127
Latest member
Cyko

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