Data to be processed using VB Macro

Nitya0808

New Member
Joined
Jul 1, 2016
Messages
42
Hello All,

There is a set of data in sheet 1.

[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]Category[/TD]
[TD]Unit[/TD]
[TD]Period[/TD]
[TD]Data[/TD]
[TD]Lifecycle[/TD]
[/TR]
</tbody>[/TABLE]


There are 5 different units, and the categories can be similar or different across data. The data needs to categorized across units, per category, per period based on the lifecycle (only Active lifecycle is taken into calculation) in sheet 2.


Sheet 1


Cell Formulas
RangeFormula
A1Category
A2A
A3A
A4A
A5B
A6B
A7B
A8C
A9D
A10A
A11A
A12C
A13C
A14C
A15D
A16D
A17D
A18A
A19B
A20C
B1Unit
B2X
B3X
B4Y
B5Z
B6Z
B7Z
B8X
B9Y
B10X
B11Y
B12Z
B13Z
B14Z
B15W
B16W
B17W
B18X
B19Y
B20Y
C1Period
C2P01
C3P01
C4P02
C5P02
C6P01
C7P01
C8P02
C9P01
C10P02
C11P01
C12P02
C13P02
C14P01
C15P01
C16P02
C17P02
C18P01
C19P01
C20P02
D1Data
D2345
D3678
D432
D5567
D666
D7-90
D8100
D911223
D10865
D11124
D12674
D13742
D14983
D15345
D16742
D17641
D18578
D19444
D20980
E1Lifecycle
E2Active
E3Active
E4Mature
E5Active
E6Active
E7Active
E8Active
E9Active
E10Active
E11Mature
E12Active
E13Active
E14Active
E15Active
E16Active
E17Active
E18Not Applicable
E19Active
E20Active


Sheet 2


Book1
BCDEFGHIJKLMNOP
4UnitCategoryP01P02P03P04P05P06P07P08P09P10P11P12Total
5XA1,023.001,023.00
6C865.00100.00965.00
7Total1,888.00100.001,988.00
8
9
10WD345.001,383.001,728.00
11Total345.001,383.000.000.000.000.000.000.000.000.000.000.001,728.00
12
13
14YD11223.0011,223.00
15B444.0032.00476.00
16C980.00980.00
17Total11,667.001,012.0012,679.00
18
19
20ZB-24.00567.00543.00
21C983.001,416.002,399.00
22Total959.001,983.002,942.00
23
24
25OverallA1023.00865.001,888.00
26D11568.001383.0012,951.00
27B420.00567.00987.00
28C983.002496.003,479.00
29Total12,971.004,446.0019,305.00
Sheet2
Cell Formulas
RangeFormula
D7=SUM(D5:D6)
D11=D10
D17=SUM(D14:D16)
D22=SUM(D20:D21)
D29=SUM(D26:D28)
E7=SUM(E5:E6)
E11=E10
E17=SUM(E14:E16)
E22=SUM(E20:E21)
E29=SUM(E26:E28)
P5=SUM(D5:O5)
P6=SUM(D6:O6)
P7=SUM(P5:P6)
P10=SUM(D10:O10)
P11=P10
P14=SUM(D14:O14)
P15=SUM(D15:O15)
P16=SUM(D16:O16)
P17=SUM(P14:P16)
P20=SUM(D20:N20)
P21=SUM(D21:N21)
P22=SUM(D22:N22)
P25=SUM(D25:O25)
P26=SUM(D26:O26)
P27=SUM(D27:O27)
P28=SUM(D28:O28)
P29=SUM(P25:P28)
F11=F10
G11=G10
H11=H10
I11=I10
J11=J10
K11=K10
L11=L10
M11=M10
N11=N10
O11=O10
 
Hi Mick,

If data is loaded only for P01, the value is calculated only for the first category, it does not give the same output in table form like the Sheet 2 for all units and categories.

If data is loaded for 12 months, then it gives a subscipt out of range error.

Thanks,
Nitya
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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