hoopslogan
Board Regular
- Joined
- Jun 21, 2016
- Messages
- 94
Hello,
I am trying to write a macro that does the following:
1. Takes the Info located on Sheet 1 in the Range A5:Last Row in Column C and pastes these labels into a new sheet starting in cell A1 . After this is done, the macro needs to paste two more headings 1 in D1 of the new sheet titled Mean and 1 in E1 titled Std. Deviation.
2. Next I need the macro to loop through each Row value on Sheet 1 and calculate the corressponding mean and Std. Deviation for each Value 1 and Value 2 category per Business Level.
Here is some sample sheets. The first one is the input Sheet 1 where the data is being pulled from and the Second is what i want my output to look like.
<COLGROUP><COL style="WIDTH: 237pt; mso-width-source: userset; mso-width-alt: 11556" width=316><COL style="WIDTH: 215pt; mso-width-source: userset; mso-width-alt: 10459" width=286><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><COL style="WIDTH: 63pt; mso-width-source: userset; mso-width-alt: 3072" width=84><COL style="WIDTH: 66pt; mso-width-source: userset; mso-width-alt: 3218" width=88><COL style="WIDTH: 48pt" span=5 width=64><TBODY>
</TBODY>
<COLGROUP><COL style="WIDTH: 139pt; mso-width-source: userset; mso-width-alt: 6765" width=185><COL style="WIDTH: 81pt; mso-width-source: userset; mso-width-alt: 3949" width=108><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><TBODY>
</TBODY>
I am trying to write a macro that does the following:
1. Takes the Info located on Sheet 1 in the Range A5:Last Row in Column C and pastes these labels into a new sheet starting in cell A1 . After this is done, the macro needs to paste two more headings 1 in D1 of the new sheet titled Mean and 1 in E1 titled Std. Deviation.
2. Next I need the macro to loop through each Row value on Sheet 1 and calculate the corressponding mean and Std. Deviation for each Value 1 and Value 2 category per Business Level.
Here is some sample sheets. The first one is the input Sheet 1 where the data is being pulled from and the Second is what i want my output to look like.
Business Level 1 | Business Level 2 | Categories | Nov 2015 | Dec 2015 | Jan 2016 | Feb 2016 | Mar 2016 | Apr 2016 | May 2016 |
Trucking | Field 1 | Value 1 | 0.018292282 | 0.017215788 | 0.018555 | 0.018625 | 0.021163 | 0.022068 | 0.020451 |
Value 2 | 0.019497353 | 0.017774407 | 0.017996 | 0.01765 | 0.015878 | 0.016106 | 0.017905 | ||
Field 2 | Value 1 | 0.011103615 | 0.012955858 | 0.011938 | 0.013527 | 0.01817 | 0.01816 | 0.018428 | |
Value 2 | 0.042906473 | 0.039713642 | 0.039297 | 0.03889 | 0.038697 | 0.0383 | 0.037 | ||
Field 3 | Value 1 | 0.019441891 | 0.02094907 | 0.019904 | 0.020109 | 0.030064 | 0.029734 | 0.030599 | |
Value 2 | 0.041224126 | 0.037661868 | 0.037813 | 0.037924 | 0.037245 | 0.036825 | 0.035153 | ||
Field 4 | Value 1 | 0.002757527 | 0.002808645 | 0.002959 | 0.003535 | 0.003696 | 0.003741 | 0.003956 | |
Value 2 | 0.029784166 | 0.027552318 | 0.027926 | 0.027592 | 0.027855 | 0.027857 | 0.028447 | ||
Trucking Value 1 Total | 0.012817403 | 0.013688691 | 0.013244 | 0.013983 | 0.018667 | 0.018673 | 0.018678 | ||
Trucking Value 2 Total | 0.133412118 | 0.122702235 | 0.123032 | 0.122056 | 0.119676 | 0.119087 | 0.118504 | ||
Cycling | Field 5 | Value 1 | 0.013160598 | 0.011425348 | 0.011546 | 0.011421 | 0.011273 | 0.010464 | 0.010359 |
Value 2 | 0.007752711 | 0.006728032 | 0.006537 | 0.006687 | 0.006652 | 0.006773 | 0.006766 | ||
Field 6 | Value 1 | 0.01213892 | 0.011799774 | 0.012159 | 0.012313 | 0.012443 | 0.009221 | 0.008852 | |
Value 2 | 0.022646502 | 0.021547952 | 0.021613 | 0.020304 | 0.019732 | 0.018554 | 0.018263 | ||
Field 7 | Value 1 | 0.01227798 | 0.012246215 | 0.010912 | 0.011548 | 0.012084 | 0.012756 | 0.01279 | |
Value 2 | 0.056752623 | 0.054470664 | 0.054201 | 0.048061 | 0.046563 | 0.046087 | 0.046196 | ||
Cycling Value 1 Total | 0.012320149 | 0.012063152 | 0.01129 | 0.011744 | 0.012107 | 0.011619 | 0.011547 | ||
Cycling Value 2 Total | 0.087151835 | 0.082746648 | 0.082351 | 0.075052 | 0.072947 | 0.071414 | 0.071225 | ||
Instrumental | Field 8 | Value 1 | 0.005973322 | 0.006523278 | 0.006547 | 0.004808 | 0.007178 | 0.006923 | 0.007086 |
Value 2 | 0.008196146 | 0.00691488 | 0.006917 | 0.010687 | 0.005604 | 0.005713 | 0.004776 | ||
Field 9 | Value 1 | 0.00241694 | 0.002633987 | 0.002619 | 0.002633 | 0.002527 | 0.002574 | 0.002611 | |
Value 2 | 0.342665965 | 0.329673643 | 0.32987 | 0.326451 | 0.346456 | 0.349443 | 0.346403 | ||
Instrumental Value 1 Total | 0.002499821 | 0.002713687 | 0.002699 | 0.002701 | 0.002601 | 0.002643 | 0.002671 | ||
Instrumental Value 2 Total | 0.35086211 | 0.336588523 | 0.336786 | 0.337138 | 0.352061 | 0.355156 | 0.351179 | ||
Magnetic | Field 10 | Value 1 | 0.004658367 | 0.004899963 | 0.004696 | 0.004635 | 0.00609 | 0.005871 | 0.005631 |
Value 2 | 0.036438136 | 0.030681078 | 0.031537 | 0.032921 | 0.025266 | 0.026259 | 0.027404 | ||
Magnetic Value 1 Total | 0.004658367 | 0.004899963 | 0.004696 | 0.004635 | 0.00609 | 0.005871 | 0.005631 | ||
Magnetic Value 2 Total | 0.036438136 | 0.030681078 | 0.031537 | 0.032921 | 0.025266 | 0.026259 | 0.027404 | ||
Manufacturers | Field 11 | Value 1 | 0.015229936 | 0.017091097 | 0.016923 | 0.016454 | 0.017243 | 0.00661 | 0.006515 |
Value 2 | 0.001574901 | 0.001102071 | 0.001285 | 0.001258 | 0.001289 | 0.001333 | 0.001275 | ||
Field 12 | Value 1 | 0.007831096 | 0.008936853 | 0.009151 | 0.010052 | 0.01117 | 0.011391 | 0.011495 | |
Value 2 | 0.052919865 | 0.064596674 | 0.062488 | 0.060838 | 0.057735 | 0.057665 | 0.059187 | ||
Field 13 | Value 1 | 0.010653971 | 0.010446321 | 0.010304 | 0.010394 | 0.010683 | 0.010401 | 0.010365 | |
Value 2 | 0.056155112 | 0.052552226 | 0.054865 | 0.054414 | 0.055344 | 0.056208 | 0.057572 | ||
Field 14 | Value 1 | 0.010972593 | 0.009741 | 0.009882 | 0.009937 | 0.008994 | 0.009078 | 0.007514 | |
Value 2 | 0.042807053 | 0.046959394 | 0.047 | 0.046241 | 0.045835 | 0.045242 | 0.045338 | ||
Manufacturers Value 1 Total | 0.009814744 | 0.009698141 | 0.009799 | 0.010182 | 0.010428 | 0.010355 | 0.009957 | ||
Manufacturers Value 2 Total | 0.153456931 | 0.165210365 | 0.165637 | 0.162751 | 0.160203 | 0.160448 | 0.163373 | ||
Unknown | Field 15 | Value 1 | 0.007310543 | 0.006585357 | 0.006066 | 0.005859 | 0.005685 | 0.005543 | 0.005521 |
Value 2 | 0.005641602 | 0.00504401 | 0.004931 | 0.00487 | 0.004758 | 0.004876 | 0.004774 | ||
Field 16 | Value 1 | 0.011695711 | 0.011039222 | 0.013375 | 0.008341 | 0.008817 | 0.00878 | 0.008646 | |
Value 2 | 0.017017625 | 0.008313026 | 0.013728 | 0.022558 | 0.022855 | 0.021809 | 0.022175 | ||
Unkown Value 1 Total | 0.010577768 | 0.009307865 | 0.011413 | 0.007895 | 0.008274 | 0.008182 | 0.008087 | ||
Unknown Value 2 Total | 0.022659227 | 0.013357035 | 0.01866 | 0.027427 | 0.027613 | 0.026686 | 0.026949 | ||
Boating | Field 17 | Value 1 | 0.01508724 | 0.014975386 | 0.014357 | 0.014314 | 0.013867 | 0.013602 | 0.012971 |
Value 2 | 0.071923287 | 0.068454925 | 0.068909 | 0.0687 | 0.069092 | 0.0683 | 0.068696 | ||
Boating Value 1 Total | 0.01508724 | 0.014975386 | 0.014357 | 0.014314 | 0.013867 | 0.013602 | 0.012971 | ||
Boating Value 2 Total | 0.071923287 | 0.068454925 | 0.068909 | 0.0687 | 0.069092 | 0.0683 | 0.068696 | ||
Environmental | Field 18 | Value 1 | 0.011804396 | 0.013177369 | 0.012624 | 0.012756 | 0.013025 | 0.011656 | 0.011556 |
Value 2 | 0.014038757 | 0.014327595 | 0.014608 | 0.014469 | 0.014403 | 0.015322 | 0.015719 | ||
Field 19 | Value 1 | 0.015177655 | 0.015864653 | 0.016209 | 0.01524 | 0.015617 | 0.015254 | 0.015183 | |
Value 2 | 0.009989737 | 0.009725231 | 0.009247 | 0.009077 | 0.008885 | 0.009009 | 0.008559 | ||
Field 20 | Value 1 | 0.013432295 | 0.012138514 | 0.012096 | 0.012375 | 0.01275 | 0.012375 | 0.012283 | |
Value 2 | 0.005396849 | 0.005093119 | 0.005053 | 0.005113 | 0.005121 | 0.005001 | 0.005045 | ||
Field 21 | Value 1 | 0.009217558 | 0.009130646 | 0.00925 | 0.009481 | 0.0092 | 0.009386 | 0.009504 | |
Value 2 | 0.037504641 | 0.037125692 | 0.038861 | 0.03917 | 0.039334 | 0.038989 | 0.039066 | ||
Field 22 | Value 1 | 0.008836323 | 0.008936838 | 0.009081 | 0.00831 | 0.008648 | 0.008356 | 0.008683 | |
Value 2 | 0.014406836 | 0.01365462 | 0.013671 | 0.014869 | 0.01467 | 0.014846 | 0.014859 | ||
Field 23 | Value 1 | 0.009278647 | 0.011286824 | 0.010634 | 0.009935 | 0.010021 | 0.009788 | 0.009714 | |
Value 2 | 0.027339928 | 0.029308458 | 0.027102 | 0.026871 | 0.026463 | 0.025261 | 0.025393 | ||
Field 24 | Value 1 | 0.011741724 | 0.01168583 | 0.011396 | 0.011266 | 0.011082 | 0.011012 | 0.010881 | |
Value 2 | 0.012775894 | 0.011986324 | 0.011796 | 0.011993 | 0.012041 | 0.011696 | 0.011726 | ||
Field 25 | Value 1 | 0.00748427 | 0.016432321 | 0.014328 | 0.014129 | 0.014507 | 0.015395 | 0.01524 | |
Value 2 | 0.022643714 | 0.059038152 | 0.052751 | 0.052391 | 0.052225 | 0.052527 | 0.052302 | ||
Environmental Value 1 Total | 0.009955292 | 0.012781839 | 0.011875 | 0.011618 | 0.011752 | 0.011876 | 0.011832 | ||
Environmental Value 2 Total | 0.144096356 | 0.18025919 | 0.173089 | 0.173955 | 0.173142 | 0.172651 | 0.172669 | ||
Total Value 1 | 0.008078417 | 0.008782787 | 0.008482 | 0.008514 | 0.009046 | 0.008974 | 0.00888 | ||
Total Value 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
<COLGROUP><COL style="WIDTH: 237pt; mso-width-source: userset; mso-width-alt: 11556" width=316><COL style="WIDTH: 215pt; mso-width-source: userset; mso-width-alt: 10459" width=286><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><COL style="WIDTH: 63pt; mso-width-source: userset; mso-width-alt: 3072" width=84><COL style="WIDTH: 66pt; mso-width-source: userset; mso-width-alt: 3218" width=88><COL style="WIDTH: 48pt" span=5 width=64><TBODY>
</TBODY>
Business Level 1 | Business Level 2 | Categories | Mean | Std. Dev |
Trucking | Field 1 | Value 1 | ||
Value 2 | ||||
Field 2 | Value 1 | |||
Value 2 | ||||
Field 3 | Value 1 | |||
Value 2 | ||||
Field 4 | Value 1 | |||
Value 2 | ||||
Trucking Value 1 Total | ||||
Trucking Value 2 Total | ||||
Cycling | Field 5 | Value 1 | ||
Value 2 | ||||
Field 6 | Value 1 | |||
Value 2 | ||||
Field 7 | Value 1 | |||
Value 2 | ||||
Cycling Value 1 Total | ||||
Cycling Value 2 Total | ||||
Instrumental | Field 8 | Value 1 | ||
Value 2 | ||||
Field 9 | Value 1 | |||
Value 2 | ||||
Instrumental Value 1 Total | ||||
Instrumental Value 2 Total | ||||
Magnetic | Field 10 | Value 1 | ||
Value 2 | ||||
Magnetic Value 1 Total | ||||
Magnetic Value 2 Total | ||||
Manufacturers | Field 11 | Value 1 | ||
Value 2 | ||||
Field 12 | Value 1 | |||
Value 2 | ||||
Field 13 | Value 1 | |||
Value 2 | ||||
Field 14 | Value 1 | |||
Value 2 | ||||
Manufacturers Value 1 Total | ||||
Manufacturers Value 2 Total | ||||
Unknown | Field 15 | Value 1 | ||
Value 2 | ||||
Field 16 | Value 1 | |||
Value 2 | ||||
Unkown Value 1 Total | ||||
Unknown Value 2 Total | ||||
Boating | Field 17 | Value 1 | ||
Value 2 | ||||
Boating Value 1 Total | ||||
Boating Value 2 Total | ||||
Environmental | Field 18 | Value 1 | ||
Value 2 | ||||
Field 19 | Value 1 | |||
Value 2 | ||||
Field 20 | Value 1 | |||
Value 2 | ||||
Field 21 | Value 1 | |||
Value 2 | ||||
Field 22 | Value 1 | |||
Value 2 | ||||
Field 23 | Value 1 | |||
Value 2 | ||||
Field 24 | Value 1 | |||
Value 2 | ||||
Field 25 | Value 1 | |||
Value 2 | ||||
Environmental Value 1 Total | ||||
Environmental Value 2 Total | ||||
Total Value 1 |
<COLGROUP><COL style="WIDTH: 139pt; mso-width-source: userset; mso-width-alt: 6765" width=185><COL style="WIDTH: 81pt; mso-width-source: userset; mso-width-alt: 3949" width=108><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 55pt; mso-width-source: userset; mso-width-alt: 2669" width=73><TBODY>
</TBODY>