Data analysis - thought it shoud be easy!

dataman001

New Member
Joined
Apr 28, 2014
Messages
19
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--> I import data into a spread sheet. it has the following columns NUMBER, NAME, GRADE, DATE and CODE.


I am attempting to produce a report that will list theNUMBER, NAME, GRADE and then the count of specific (4) codes from the code column and a second column counting (7) different codes from the code column.


Sounds simple but so far I have failed (even tried it Access).


I thought Pivotal tables would do it but I can get one count column but not the second one. Plus it doesn't count the different specified codes - only lists them.

Thanks in advance for any hellp!

<!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/> <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/> <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/> <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/> <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/> <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/> <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/> <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/> <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/> <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/> <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/> <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/> <w:LsdException Locked="false" Priority="37" Name="Bibliography"/> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} </style> <![endif]-->
 
OK started from scratch and followed all the steps. Did get a new Tab tytled YTD Summary but also Got an error and it highlighted the following line of code:

w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True
 
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.
dataman001,

If the following does not work for you, then, I will have to see your actual raw data workbook/spreadsheet.

Sample raw data sheet to start:


Excel 2007
ABCDE
1NumberNameGradeDateCode
2138716Alarid, Norah Jaylin59/23/2013AE
3138716Alarid, Norah Jaylin512/20/2013AE
4138716Alarid, Norah Jaylin58/21/2013L
5138716Alarid, Norah Jaylin58/29/2013L
6138716Alarid, Norah Jaylin511/4/2013L
7138716Alarid, Norah Jaylin511/8/2013L
8138716Alarid, Norah Jaylin53/6/2014L
9138716Alarid, Norah Jaylin53/14/2014L
10138716Alarid, Norah Jaylin54/7/2014L
11138716Alarid, Norah Jaylin58/30/2013TE
12138716Alarid, Norah Jaylin512/10/2013TE
13137457Aleman, Kimberly Guadalupe511/12/2013A
14137457Aleman, Kimberly Guadalupe512/12/2013A
15137457Aleman, Kimberly Guadalupe51/15/2014A
16137457Aleman, Kimberly Guadalupe510/29/2013AE
17137457Aleman, Kimberly Guadalupe510/30/2013AE
18137457Aleman, Kimberly Guadalupe511/6/2013AE
19137457Aleman, Kimberly Guadalupe511/7/2013AE
20137457Aleman, Kimberly Guadalupe511/8/2013AE
21137457Aleman, Kimberly Guadalupe59/30/2013L
22137457Aleman, Kimberly Guadalupe51/10/2014TE
23135341Anderson, Savannah Rose58/7/2013A
24135341Anderson, Savannah Rose512/5/2013A
25135341Anderson, Savannah Rose58/13/2013AE
26135341Anderson, Savannah Rose59/17/2013L
27135341Anderson, Savannah Rose512/17/2013L
28135341Anderson, Savannah Rose59/26/2013TE
29135341Anderson, Savannah Rose52/21/2014TE
30138705Archuleta, Adam Elijah512/16/2013L
31138705Archuleta, Adam Elijah53/4/2014L
32138705Archuleta, Adam Elijah53/6/2014L
33
Elem_Year-To-Date_Attendance427


As the macro begins, the sheet name is changed:


Excel 2007
ABCDE
1NumberNameGradeDateCode
2138716Alarid, Norah Jaylin59/23/2013AE
3138716Alarid, Norah Jaylin512/20/2013AE
4138716Alarid, Norah Jaylin58/21/2013L
5138716Alarid, Norah Jaylin58/29/2013L
6138716Alarid, Norah Jaylin511/4/2013L
7138716Alarid, Norah Jaylin511/8/2013L
8138716Alarid, Norah Jaylin53/6/2014L
9138716Alarid, Norah Jaylin53/14/2014L
10138716Alarid, Norah Jaylin54/7/2014L
11138716Alarid, Norah Jaylin58/30/2013TE
12138716Alarid, Norah Jaylin512/10/2013TE
13137457Aleman, Kimberly Guadalupe511/12/2013A
14137457Aleman, Kimberly Guadalupe512/12/2013A
15137457Aleman, Kimberly Guadalupe51/15/2014A
16137457Aleman, Kimberly Guadalupe510/29/2013AE
17137457Aleman, Kimberly Guadalupe510/30/2013AE
18137457Aleman, Kimberly Guadalupe511/6/2013AE
19137457Aleman, Kimberly Guadalupe511/7/2013AE
20137457Aleman, Kimberly Guadalupe511/8/2013AE
21137457Aleman, Kimberly Guadalupe59/30/2013L
22137457Aleman, Kimberly Guadalupe51/10/2014TE
23135341Anderson, Savannah Rose58/7/2013A
24135341Anderson, Savannah Rose512/5/2013A
25135341Anderson, Savannah Rose58/13/2013AE
26135341Anderson, Savannah Rose59/17/2013L
27135341Anderson, Savannah Rose512/17/2013L
28135341Anderson, Savannah Rose59/26/2013TE
29135341Anderson, Savannah Rose52/21/2014TE
30138705Archuleta, Adam Elijah512/16/2013L
31138705Archuleta, Adam Elijah53/4/2014L
32138705Archuleta, Adam Elijah53/6/2014L
33
Sheet1


Then the macro creates sheet YTD Summary with the results:


Excel 2007
ABCDE
1NumberNameGradeTardyAbsence
2138716Alarid, Norah Jaylin592
3137457Aleman, Kimberly Guadalupe528
4135341Anderson, Savannah Rose543
5138705Archuleta, Adam Elijah530
6
YTD Summary



Then the original/first sheet is renamed:


Excel 2007
ABCDE
1NumberNameGradeDateCode
2138716Alarid, Norah Jaylin59/23/2013AE
3138716Alarid, Norah Jaylin512/20/2013AE
4138716Alarid, Norah Jaylin58/21/2013L
5138716Alarid, Norah Jaylin58/29/2013L
6138716Alarid, Norah Jaylin511/4/2013L
7138716Alarid, Norah Jaylin511/8/2013L
8138716Alarid, Norah Jaylin53/6/2014L
9138716Alarid, Norah Jaylin53/14/2014L
10138716Alarid, Norah Jaylin54/7/2014L
11138716Alarid, Norah Jaylin58/30/2013TE
12138716Alarid, Norah Jaylin512/10/2013TE
13137457Aleman, Kimberly Guadalupe511/12/2013A
14137457Aleman, Kimberly Guadalupe512/12/2013A
15137457Aleman, Kimberly Guadalupe51/15/2014A
16137457Aleman, Kimberly Guadalupe510/29/2013AE
17137457Aleman, Kimberly Guadalupe510/30/2013AE
18137457Aleman, Kimberly Guadalupe511/6/2013AE
19137457Aleman, Kimberly Guadalupe511/7/2013AE
20137457Aleman, Kimberly Guadalupe511/8/2013AE
21137457Aleman, Kimberly Guadalupe59/30/2013L
22137457Aleman, Kimberly Guadalupe51/10/2014TE
23135341Anderson, Savannah Rose58/7/2013A
24135341Anderson, Savannah Rose512/5/2013A
25135341Anderson, Savannah Rose58/13/2013AE
26135341Anderson, Savannah Rose59/17/2013L
27135341Anderson, Savannah Rose512/17/2013L
28135341Anderson, Savannah Rose59/26/2013TE
29135341Anderson, Savannah Rose52/21/2014TE
30138705Archuleta, Adam Elijah512/16/2013L
31138705Archuleta, Adam Elijah53/4/2014L
32138705Archuleta, Adam Elijah53/6/2014L
33
Elem_Year-To-Date_Attendance427


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Code:
Sub UpdateYTDSummaryV3()
' hiker95 04/29/2014, ME774163
Dim w1 As Worksheet, wy As Worksheet
Dim lr As Long, asn As String
Application.ScreenUpdating = False
asn = ActiveSheet.Name
ActiveSheet.Name = "Sheet1"
Set w1 = Sheets("Sheet1")
If Not Evaluate("ISREF('YTD Summary'!A1)") Then Worksheets.Add(After:=w1).Name = "YTD Summary"
Set wy = Sheets("YTD Summary")
With wy
  .UsedRange.Clear
  w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True
  .Cells(1, 4).Resize(, 2).Value = Array("Tardy", "Absence")
  lr = .Cells(Rows.Count, 1).End(xlUp).Row
  With .Range("D2:D" & lr)
    .Formula = "=COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""L"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""T*"")"
    .Value = .Value
  End With
  With .Range("E2:E" & lr)
    .Formula = "=COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""A*"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""D*"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""OSS"")"
    .Value = .Value
  End With
  .Columns("A:E").AutoFit
End With
w1.Name = asn
Application.ScreenUpdating = True
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the UpdateYTDSummaryV3 macro.
 
Upvote 0
OK I opened a new worksheet - imported the data - added names to columns - named the tab Variable - Saved spread sheet as Elem_Year-To-Date_Attendance427.xlsm - moved to sheet1 and followed the directions to insert the macro - closed it and envoked it - got a Run Time Error '1004' "The command could not be completed by using the range specified. Select a single cell within the range and try the command again."
Debug highlights the following line: w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True

But I do get a new tab called YTD Summary but its balnk
 
Upvote 0
dataman001,

OK I opened a new worksheet - imported the data - added names to columns - named the tab Variable - Saved spread sheet as Elem_Year-To-Date_Attendance427.xlsm - moved to sheet1 and followed the directions to insert the macro - closed it and envoked it - got a Run Time Error '1004' "The command could not be completed by using the range specified. Select a single cell within the range and try the command again."
Debug highlights the following line: w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True

The only part of what is in the above quote that is correct is:
OK I opened a new worksheet - imported the data

You can save the workbook/spreadsheet as Elem_Year-To-Date_Attendance427.xlsm, but:

From prior instructions/directions the sheet name was/is Elem_Year-To-Date_Attendance427


We are having a major communication problem.

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
dataman001,

The only way that this will get straightened out is for you to supply your actual raw data workbook/spreadsheet after the imported the data manual part. Do not change anything.


You can upload your workbook to Box Net,

sensitive data changed

mark the workbook for sharing
and provide us with a link to your workbook.
 
Last edited:
Upvote 0
dataman001,

Thanks for the workbook.

Forget all prior instructions.

The raw data sheet name, as seen below this line of text, has to be Sheet1.

Not all 9,816 rows are shown.


Excel 2007
ABCDE
1NumberNameGradeDateCode
2133067Montour, Ramon Vicente59/25/2013L
3133067Montour, Ramon Vicente59/30/2013DTH
4133067Montour, Ramon Vicente511/4/2013L
5133067Montour, Ramon Vicente52/18/2014A
6133067Montour, Ramon Vicente52/25/2014L
7133067Montour, Ramon Vicente53/4/2014L
8132413Ringlero, Timothy Elijah58/30/2013TE
9132413Ringlero, Timothy Elijah59/12/2013TU
10132413Ringlero, Timothy Elijah510/7/2013L
11132413Ringlero, Timothy Elijah511/21/2013L
12132413Ringlero, Timothy Elijah512/5/2013AE
13132413Ringlero, Timothy Elijah512/11/2013L
14132413Ringlero, Timothy Elijah51/9/2014L
15132413Ringlero, Timothy Elijah51/13/2014AE
16132413Ringlero, Timothy Elijah52/11/2014TU
17132413Ringlero, Timothy Elijah52/18/2014TU
18132413Ringlero, Timothy Elijah53/4/2014TU
19132413Ringlero, Timothy Elijah53/5/2014AU
20132413Ringlero, Timothy Elijah53/6/2014TU
21132413Ringlero, Timothy Elijah53/11/2014T
22132413Ringlero, Timothy Elijah53/13/2014TU
23132413Ringlero, Timothy Elijah53/14/2014AU
24132413Ringlero, Timothy Elijah54/3/2014TE
25132413Ringlero, Timothy Elijah54/8/2014TU
26132413Ringlero, Timothy Elijah54/9/2014L
27132413Ringlero, Timothy Elijah54/16/2014AE
28132413Ringlero, Timothy Elijah54/17/2014AE
29132413Ringlero, Timothy Elijah54/18/2014A
30134696Montez, Bleu Alice59/26/2013L
31134696Montez, Bleu Alice510/1/2013TE
32134696Montez, Bleu Alice511/1/2013L
33134696Montez, Bleu Alice511/5/2013L
34134696Montez, Bleu Alice511/6/2013OF
35134696Montez, Bleu Alice511/13/2013AU
36134696Montez, Bleu Alice512/20/2013AU
37134696Montez, Bleu Alice53/17/2014AU
38134696Montez, Bleu Alice54/1/2014TE
Sheet1


After the macro in a new sheet, YTD Summary, not all 599 rows are shown:


Excel 2007
ABCDE
1NumberNameGradeTardyAbsence
2133067Montour, Ramon Vicente542
3132413Ringlero, Timothy Elijah5157
4134696Montez, Bleu Alice553
YTD Summary



Please print the following, and, follow the instructions exactly.


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


Code:
Sub UpdateYTDSummaryV4()
' hiker95 04/29/2014, ME774163
Dim w1 As Worksheet, wy As Worksheet
Dim lr As Long
Application.ScreenUpdating = False
Set w1 = Sheets("Sheet1")
If Not Evaluate("ISREF('YTD Summary'!A1)") Then Worksheets.Add(After:=w1).Name = "YTD Summary"
Set wy = Sheets("YTD Summary")
With wy
  .UsedRange.Clear
  w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True
  .Cells(1, 4).Resize(, 2).Value = Array("Tardy", "Absence")
  lr = .Cells(Rows.Count, 1).End(xlUp).Row
  With .Range("D2:D" & lr)
    .Formula = "=COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""L"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""T*"")"
    .Value = .Value
  End With
  With .Range("E2:E" & lr)
    .Formula = "=COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""A*"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""D*"")+COUNTIFS(Sheet1!A:A,A2,Sheet1!E:E,""OSS"")"
    .Value = .Value
  End With
  .Columns("A:E").AutoFit
End With
Application.ScreenUpdating = True
End Sub

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

Then run the UpdateYTDSummaryV4 macro.
 
Upvote 0
Did exactly as you instructed.
On your step 7 after ALT+Q keys are depressed I return to a blank Sheet1 (is that correct?) Then when I envoke the macro press ALT + F8
I see the MACRO Name To choose (UpdateYTDSummaryV4) double ckick it to run the macroThen the runtime error appears.
I do get a YTD Summary tab but it has no data.

I still get a runtime error '1004'

The debug code line is this line:
w1.Columns("A:C").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Columns("A:C"), Unique:=True


 
Upvote 0
dataman001,

On your step 7 after ALT+Q keys are depressed I return to a blank Sheet1 (is that correct?)

NO.

OK I opened a new worksheet - imported the data - added names to columns - named the tab Sheet1

Then, after the import, you run the macro.


After four macros, and, many screenshots, you are still not following my instructions correctly.

I strongly suggest that you take an Excel training course that teaches how to use macros.


Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0

Forum statistics

Threads
1,215,328
Messages
6,124,295
Members
449,149
Latest member
mwdbActuary

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