Automating Tables

Brew

Well-known Member
Joined
Sep 29, 2003
Messages
1,569
I would like to program 3 tables within excel that automatically updates the following data:

in U column
how many 3s, 2s 1s, and 0s in the last 10 entries and the percentages for each.
Also, how many for the last 100 entries and their percentages.
I have a 2nd column (column EM) that produces 0s, 1s, 2s and 3s. I need the last 10 entries and the percentages for each.
Also, how many for the last 100 entries and their percentages.
I would like to do the same for the data in a 3rd column (AV column) which has only 1s, 2s and 3s.

Some cells in the columns are blank, so ingnore those as non-entries.
PC Pick3 System Chart3.xls
ECEDEEEFEGEHEIEJEKEL
21E/O(ColumnU)D/S(ColumnAV)
223210123
23Last10Last10
24%%
25Last100Last100
26%%
27
28
29H/Low(ColumnEM)
303210
31Last10
32%
33Last100
34%
combo
PC Pick3 System Chart3.xls
EMENEOEP
51
52
532
54
552
56
571
58
590
60
611
62
631
64
combo
 
Hi Brew:

Hi Brew:
To automate the process, we need to do the following …

1. We have to use a dynamic range --so when you make a new entry, it is accounted for
a) to do that for column B entries, I have set up a dynamic range ...
yDynRng … =Sheet3a!$B$5:INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B)+1,Sheet3a!$B:$B))
b) I changed the formula in cell E2 making part of the AdvancedFilter Criteria to
=COUNT(B6:$B$65536)<=$B$2

2. Create a Worksheet_Change event that would execute Advanced Filter on making an additional numeric entry in column B
a) the Worksheet_Change event code is ...
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Not Intersect(Target, Range("yNewEntryLocation")) Is Nothing Then
        Range("yDynRng").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("D1:E2"), CopyToRange:=Range("D5")
    End If
End Sub
b) I created a range named yNewEntryLocation ...
y NewEntryLocation … =INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B),Sheet3a!$B:$B))

I have used the dynamic ranges and the Worksheet_Change code in the following illustration ...
y040121h1a.xls
BCDEFGHIJ
1CountLast
210FALSEFALSE
3numericentries
4
5entryentryNumberOf3210
6blank13322
7text3
822
930source
102criteria
1113copyto
1230
13text3
1412
15text1
163
172
180
192
203
210
223
232
24k
251
Sheet3a


I hope this helps!
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Where do I place the following in my sheet:
yDynRng … =Sheet3a!$B$5:INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B)+1,Sheet3a!$B:$B))
and
y NewEntryLocation … =INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B),Sheet3a!$B:$B))

Also, I guess the code is to be place in the module.

Also, I assume I have to change your "sheet3a" reference to "combo" since that is the name of my sheet, and also change my column references, since it is different in my sheet.
 
Upvote 0
Brew said:
Where do I place the following in my sheet:
yDynRng … =Sheet3a!$B$5:INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B)+1,Sheet3a!$B:$B))
and
y NewEntryLocation … =INDEX(Sheet3a!$B:$B,MATCH(MAX(Sheet3a!$B:$B),Sheet3a!$B:$B))
The range names are created from within the sheet of interest by invoking INSERT|Name|Define and then proceed from there.

Also, I guess the code is to be place in the module.
The code is to be placed in the Worksheet's module and not in a general module.

Also, I assume I have to change your "sheet3a" reference to "combo" since that is the name of my sheet, and also change my column references, since it is different in my sheet.
Yep, that's right!

Good Luck!
 
Upvote 0
How do I add this code to the worksheet module, when I already have code in the worksheet module for another application within my chart?

Also, is this adjustment to your formula okay:
=COUNT(U38:$U$65536)<=$ED$19
I placed 10 in the ED19 cell. does it have to be in the U column?

I believe have everything else cell up correctly.
So when I add a couple row with one additional numeric entry how when the chart update? do I have to press a key?

Also, what automation adjustments do I make when I want to look at 100 entries, instead of 10 or a different column of data entry?
 
Upvote 0
Brew said:
How do I add this code to the worksheet module, when I already have code in the worksheet module for another application within my chart?
One can have more than one worksheet event code associated with a worksheet -- but not knowing what event you already have in the worksheet, I can not say if there will be a conflict or whther they will both work in harmony.

Also, is this adjustment to your formula okay:
=COUNT(U38:$U$65536)<=$ED$19
I placed 10 in the ED19 cell. does it have to be in the U column?
Yes this seems to be OK -- the intent here is that count of numeric entries in all the cells in column U starting with U38 and going all the way down should be <= the entry in cell ED19.

I believe have everything else cell up correctly.
So when I add a couple row with one additional numeric entry how when the chart update? do I have to press a key?
It is the purpose of the Worksheet_Change event to monitor that a numeric entry has been made at the end of the range of numeric entries in column U and then fire up accordingly.

Also, what automation adjustments do I make when I want to look at 100 entries, instead of 10 or a different column of data entry?
I would rather have everything working for the count of 10 and not confound it with the matter of 100 entries at this time.

Good Luck Brew!
 
Upvote 0
I added 2 rows to the column with one new numeric entry,
but the table and the coppyto range did not update.
row 299 was blank and row 300 had a #1.
 
Upvote 0
Hi Brew:

At this point. I can not tell you what might be happening. It is working for me. It seems like a fairly large project -- for this you may need more than just help on the board. Send me a PM with some details of the project -- and then let us take it from there.
 
Upvote 0
I updated the formula references as you suggested.
But I am getting an "ambigious name detected" error in the worksheet module. How do I fix that error?
 
Upvote 0
Hi Brew:

Please check if you have two code modules by the same name -- each code module needs to have a unique name.
 
Upvote 0
I now need a formula to look at the U column for the last 30 numerical entries, ignoring the blank or empty cells and then list the number in another column (EO35:EO65), each numerical entry in the order it occurred in the U column, and excluding empty cells. Everytime, I add a new value in the U column the values in EO35:EO65 should update accordingly.
Also, I want to take the last 60 numerical entries in AV and place in column ER5:ER65 in the exact order occurred excluding empty cells, then copy and paste only the values in the 30 odd numbered ER cells, starting with ER5 and ending with ER65, place those values in the order they occurred into EQ35:EQ65.
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,956
Latest member
JPav

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