Get total from possible result sheet, in to pivot table… if criteria match

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Hello,

Example below the Sheet Source; shows as data received.


Book1
ABCDE
1YearEMCount-1Sum-1Patterns-1
2YearEMCount-1Sum-1Patterns-1
319755802,1,1,1
419784673,1
519805801,3,1
619854671,1,1,1
719855802,1,1,1
819884672,1,1
919904671,1,1,1
1019905801,1,1,2
1119923361,2
1219933361,1,1
1319935802,2,1
1419963301,1,1
1519984671,1,2
1619985502,1,2
1720003212,1
1820014671,1,1,1
1920015801,1,3
2020024672,1,1
2120033362,1
2220035804,1
2320035803,1,1
2420054671,1,1,1
2520064283,1
2620074672,1,1
2720084671,2,1
2820084672,1,1
2920103182,1
3020104671,1,2
3120115801,1,2,1
3220124671,2,1
3320125803,2
3420125802,1,1,1
3520133301,1,1
3620134672,1,1
3720135801,2,1,1
3820143301,2
Source


Example below the Sheet Pivot Table; shows data result of 3 fields (Count-1, Sum-1, Patterns-1) of Source Sheet in to the pivot table.


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
6Total 181
7212,11
8Total 211
9301,1,12
101,21
11Total 303
12361,1,11
131,21
142,11
15Total 363
16Total 38
174283,11
18Total 281
19671,1,1,14
201,1,22
211,2,12
222,1,15
233,11
24Total 6714
25Total 415
265502,1,21
27Total 501
28801,1,1,21
291,1,2,11
301,1,31
311,2,1,11
321,3,11
332,1,1,13
342,2,11
353,1,11
363,21
374,11
38Total 8012
39Total 513
40Total general36
Pivot Table


Example below the Sheet Possible Results; shows all possible result could be formed with 3 fields (Count-1, Sum-1, Patterns-1).


Book1
ABCD
1
2
3Contar de Count-1
4Count-1Sum-1Patterns-1Total
53181,21
63182,11
732131
83211,1,11
93212,11
1033031
113301,1,13
123301,21
133302,12
143361,1,15
153361,22
163362,13
17Total 322
184282,21
194283,11
204671,1,1,116
214671,1,25
224671,2,17
234671,32
244672,1,111
254673,12
264702,24
274703,12
284731,1,1,120
294733,12
30Total 473
3155051
325501,3,11
335502,1,21
345502,2,11
355503,1,12
365504,11
3758051
385801,1,1,1,17
395801,1,1,23
405801,1,2,15
415801,1,32
425801,2,1,19
435801,2,22
445801,3,15
455802,1,1,112
465802,1,24
475802,2,16
485802,31
495803,1,17
505803,21
515804,11
52Total 573
53Total general168
Possible Results


Here is what I need as shown in the Sheet Result Required in column F find total from; Sheet Possible Results
If 3 fields (Count-1, Sum-1, Patterns-1) criteria match as shown


Book1
ABCDEF
1
2
3CountTT:Find In Sheet Possible Results
4Count-1Sum-1Patterns-1TotalTT:Find In Sheet Possible Results
53182,111
6Total 181
7212,111
8Total 211
9301,1,123
101,211
11Total 303
12361,1,115
131,212
142,113
15Total 363
16Total 38
174283,111
18Total 281
19671,1,1,1416
201,1,225
211,2,127
222,1,1511
233,112
24Total 6714
25Total 415
265502,1,211
27Total 501
28801,1,1,213
291,1,2,115
301,1,312
311,2,1,119
321,3,115
332,1,1,1312
342,2,116
353,1,117
363,211
374,111
38Total 8012
39Total 513
40Total general36
Result Required


Example Sheet Pivot Table; 3 fields (Count-1, A5 = 3… Sum-1, B5 = 18… Patterns-1, C5 = 2,1) look in to Sheet Possible Results if criteria match show total in column F5

Example Sheet Pivot Table; 3 fields (Count-1, A5 = 3… Sum-1, B7 = 21… Patterns-1, C7 = 2,1) look in to Sheet Possible Results if criteria match show total in column F7

Example Sheet Pivot Table; 3 fields (Count-1, A5 = 3… Sum-1, B9 = 30… Patterns-1, C9 = 1,1,1) look in to Sheet Possible Results if criteria match show total in column F9

Example Sheet Pivot Table; 3 fields (Count-1, A5 = 3… Sum-1, B9 = 30… Patterns-1, C10 = 1,2) look in to Sheet Possible Results if criteria match show total in column F10


Note; pivot table change every time data is filled in source sheet so I think VBA solution will be work great
It is just my thought.


I am using excel version 2000
Thank you in advance.

Regards,
Moti
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hello,

When I generate pivot table from my source sheet it looks like shown as below where in column A & B cells are empty.


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
6Total 181
7212,11
8Total 211
9301,1,12
101,21
11Total 303
12361,1,11
131,21
142,11
15Total 363
16Total 38
174283,11
18Total 281
19671,1,1,14
201,1,22
211,2,12
222,1,15
233,11
24Total 6714
25Total 415
265502,1,21
27Total 501
28801,1,1,21
291,1,2,11
301,1,31
311,2,1,11
321,3,11
332,1,1,13
342,2,11
353,1,11
363,21
374,11
38Total 8012
39Total 513
40Total general36
Pivot Table


Is there are any ways so pivot table look like this as shown with all cells filled.


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
63Total 181
73212,11
83Total 211
93301,1,12
103301,21
113Total 303
123361,1,11
133361,21
143362,11
153Total 363
16Total 3Total 368
174283,11
184Total 281
194671,1,1,14
204671,1,22
214671,2,12
224672,1,15
234673,11
244Total 6714
25Total 4Total 6715
265502,1,21
275Total 501
285801,1,1,21
295801,1,2,11
305801,1,31
315801,2,1,11
325801,3,11
335802,1,1,13
345802,2,11
355803,1,11
365803,21
375804,11
385Total 8012
39Total 513
40Total general36
Pivot Table-Filled All Cells


Regards,
Moti
 
Upvote 0
Hello, may be is this possible

Original Data


Book1
ABCDE
2YearEMCount-1Sum-1Patterns-1
319755802,1,1,1
419784673,1
519805801,3,1
619854671,1,1,1
719855802,1,1,1
819884672,1,1
919904671,1,1,1
1019905801,1,1,2
1119923361,2
1219933361,1,1
1319935802,2,1
1419963301,1,1
1519984671,1,2
1619985502,1,2
1720003212,1
1820014671,1,1,1
1920015801,1,3
2020024672,1,1
2120033362,1
2220035804,1
2320035803,1,1
2420054671,1,1,1
2520064283,1
2620074672,1,1
2720084671,2,1
2820084672,1,1
2920103182,1
3020104671,1,2
3120115801,1,2,1
3220124671,2,1
3320125803,2
3420125802,1,1,1
3520133301,1,1
3620134672,1,1
3720135801,2,1,1
3820143301,2
Orignal Data


Macro can give result as shown in sheet2


Book1
ABCD
1
2
3Count-1Sum-1Patterns-1Total
43182,11
53212,11
63301,1,12
73301,21
83361,1,11
93361,21
103362,11
11Total 38
124283,11
134671,1,1,14
144671,1,22
154671,2,12
164672,1,15
174673,11
18Total 415
195502,1,21
205801,1,1,21
215801,1,2,11
225801,1,31
235801,2,1,11
245801,3,11
255802,1,1,13
265802,2,11
275803,1,11
285803,21
295804,11
30Total 513
31Total general36
Macro Resume Data


Thank you

Regards,
Moti
 
Upvote 0
Hello, may be is this possible

Original Data

ABCDE
2YearEMCount-1Sum-1Patterns-1
319755802,1,1,1
419784673,1
519805801,3,1
619854671,1,1,1
719855802,1,1,1
819884672,1,1
919904671,1,1,1
1019905801,1,1,2
1119923361,2
1219933361,1,1
1319935802,2,1
1419963301,1,1
1519984671,1,2
1619985502,1,2
1720003212,1
1820014671,1,1,1
1920015801,1,3
2020024672,1,1
2120033362,1
2220035804,1
2320035803,1,1
2420054671,1,1,1
2520064283,1
2620074672,1,1
2720084671,2,1
2820084672,1,1
2920103182,1
3020104671,1,2
3120115801,1,2,1
3220124671,2,1
3320125803,2
3420125802,1,1,1
3520133301,1,1
3620134672,1,1
3720135801,2,1,1
3820143301,2

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



Macro can give result as shown in sheet2

ABCD
1
2
3Count-1Sum-1Patterns-1Total
43182,11
53212,11
63301,1,12
73301,21
83361,1,11
93361,21
103362,11
11Total 38
124283,11
134671,1,1,14
144671,1,22
154671,2,12
164672,1,15
174673,11
18Total 415
195502,1,21
205801,1,1,21
215801,1,2,11
225801,1,31
235801,2,1,11
245801,3,11
255802,1,1,13
265802,2,11
275803,1,11
285803,21
295804,11
30Total 513
31Total general36

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Macro Resume Data



Thank you

Regards,
Moti

bump
 
Upvote 0
Hello, I am trying to searching answer in Mr.Excel & Google using word “vba unique list” find many macro and tried all but do not find any what I want "List unique and give unique totals"?

Please any suggestion

Thank You

Regards
Moti
 
Upvote 0
Hello, search all the day but I think there is a no VBA to complete the task what I want.

But yes may be possible if I change the idea that could work

VBA Fill Blanks in column A, B, C, D if find

Original


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
6Total 181
7212,11
8Total 211
9301,1,12
101,21
11Total 303
12361,1,11
131,21
142,11
15Total 363
16Total 38
174283,11
18Total 281
19671,1,1,14
201,1,22
211,2,12
222,1,15
233,11
24Total 6714
25Total 415
265502,1,21
27Total 501
28801,1,1,21
291,1,2,11
301,1,31
311,2,1,11
321,3,11
332,1,1,13
342,2,11
353,1,11
363,21
374,11
38Total 8012
39Total 513
40Total general36
Orignal


Result


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
63Total 181
73212,11
83Total 211
93301,1,12
103301,21
113Total 303
123361,1,11
133361,21
143362,11
153Total 363
16Total 38
174283,11
184Total 281
194671,1,1,14
204671,1,22
214671,2,12
224672,1,15
234673,11
244Total 6714
25Total 415
265502,1,21
275Total 501
285801,1,1,21
295801,1,2,11
305801,1,31
315801,2,1,11
325801,3,11
335802,1,1,13
345802,2,11
355803,1,11
365803,21
375804,11
385Total 8012
39Total 513
40Total general36
Result


Please Help
Thank you

Regards,
Moti
 
Upvote 0
Hello, I found macro AutoFill2 at the link below modified a range and work fine.
http://www.mrexcel.com/forum/excel-...rge-then-copying-blank-cells.html#post2785182
Code:
Sub AutoFill2()
Dim rng As Range
Dim c As Range
Dim lr As Integer
    lr = Cells(Rows.Count, 2).End(xlUp).Row
'Assign Formula in Range
    Range("A5:B" & lr).SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
'Assign Range to work with
    Set rng = Range("A5:B" & lr)
'Assign Value inplace of formulas
    For Each c In rng
        c.Value = c.Value
    Next c
End Sub

Before Macro


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
6Total 181
7212,11
8Total 211
9301,1,12
101,21
11Total 303
12361,1,11
131,21
142,11
15Total 363
16Total 38
174283,11
18Total 281
19671,1,1,14
201,1,22
211,2,12
222,1,15
233,11
24Total 6714
25Total 415
265502,1,21
27Total 501
28801,1,1,21
291,1,2,11
301,1,31
311,2,1,11
321,3,11
332,1,1,13
342,2,11
353,1,11
363,21
374,11
38Total 8012
39Total 513
40Total general36
Before Macro


After Macro


Book1
ABCD
1
2
3Count
4Count-1Sum-1Patterns-1Total
53182,11
63Total 181
73212,11
83Total 211
93301,1,12
103301,21
113Total 303
123361,1,11
133361,21
143362,11
153Total 363
16Total 3Total 368
174283,11
184Total 281
194671,1,1,14
204671,1,22
214671,2,12
224672,1,15
234673,11
244Total 6714
25Total 4Total 6715
265502,1,21
275Total 501
285801,1,1,21
295801,1,2,11
305801,1,31
315801,2,1,11
325801,3,11
335802,1,1,13
345802,2,11
355803,1,11
365803,21
375804,11
385Total 8012
39Total 513
40Total general36
After Macro


Please need help can someone take a look so macro do not fill cells are highlighted in green will be great help

Thank you

Regards,
Moti
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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