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.

CategoryUnitPeriodDataLifecycle

<tbody>
</tbody>


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
 
Sure..

Similar to sheet 1, Sheet 3 also contains data but of previous year. That needs to be processed and displayed in Sheet 2, next to the current output.

Sheet 4 makes monthly calculations based on the information in Sheet2.

The Reporting month in Sheet 2 & Sheet 4 is a configurable field from 1 - 12, which will be done manually.

Sample file can be found here.

https://app.box.com/s/ba5l2vf4vd21i4yxfdxiwgkz0a5j5ddx

Thanks in advance for your help.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Are you saying the original code is now working OK, based on your original request, because your latest post seems to be a new requirement.???
 
Last edited:
Upvote 0
Hi Mick,

Yes. As said in my previous post, these are further enhancements i need on the file. Is it okie to have it here in the same thread?

Thanks,
Nitya

Are you saying the original code is now working OK, based on your original request, because your latest post seems to be a new requirement.???
 
Upvote 0
What about:-
Also for displaying Subunits,can we add a condition that we display subunits only when Unit is X.

Ref:- New requirement.
Do you just want the 4 columns on sheet2 starting "S5", but where does that data come from???, they don't appear to match with sheet 3 values.!!
 
Upvote 0
What about:-


Ref:- New requirement.
Do you just want the 4 columns on sheet2 starting "S5", but where does that data come from???, they don't appear to match with sheet 3 values.!!

Yes. It comes from Sheet3. It is the Sum of Values from P01 - P12 for Category G in unit W
 
Upvote 0
If I run sheet1 code on sheet 3 ,this is what I Get for "P1".

This does not match what you have.!!

content
 
Upvote 0
But what about the Units column, your sheet2 columns "S" data reflects the "Units" column for sheets1 results which is not the same as sheet3 "Units" column results.
 
Upvote 0
But what about the Units column, your sheet2 columns "S" data reflects the "Units" column for sheets1 results which is not the same as sheet3 "Units" column results.

Hi,

The order of display should be the same for Sheet 1 data and Sheet 3 data, though they might not be in the same order in the respective sheets. Only then the result needed for Sheet 4 can be achieved. If they dont match Sheet 4 calculations will become very complex and confusing.
 
Upvote 0

Forum statistics

Threads
1,215,329
Messages
6,124,302
Members
449,150
Latest member
NyDarR

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