Solved

Consolidate Excel values into  final aggregated groups

Posted on 2011-02-21
10
262 Views
Last Modified: 2012-05-11
I have an Excel sheet . It consists of the projects expenditures of each project for different months. Some projects would have more than one entry. The expenditures are in billions of dollars.

Some projects would start in Jan and would end by Dec. So that Start quarter would be Q1 and end quarter would be Q4. Some projects would start in Apr and the end by Dec. So the start quarter for them is Q2 and End quarter is Q4.
If a project is started in a certain quarter, then atleast one cell value in that quarter would have an expenditure value. If  all the project entry values for all the months are 0.00 then it means that the project had ended in that value.
For example if a project had 4 entries and all the values of that project from Oct to December are 0.00 it means the project ended by Sept. The project end quarter is Q3.
Similarily, if the project had 4 entries and all values of that project from Jan to March are 0.00 then the project had no entries in Q1  and the project start quarter is Q2.

I am attaching the input Excel sheet and the out put that I am expecting
Could some one please suggest a VBA code as to how to achieve it?

Thanks

PROJ-SALES.xls
0
Comment
Question by:vsuripeddi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 

Author Comment

by:vsuripeddi
ID: 34945715
Please submit Excel VBA code
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34945882
vsuripeddi,

In cell D26 you could use this formula and copy it down the column:

=SUMPRODUCT(AND(MONTH($B$1:$M$1)>=B26,MONTH($B$1:$M$1)<=C26)*($A$2:$A$18=A26)*$B$2:$M$18)

It's in the attached file.

Patrick
PROJ-SALES-01.xls
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34946049
vsuripeddi,

Perhaps the attached file is better. Please check it out.

Patrick
PROJ-SALES-02.xls
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

by:
dev00790 earned 500 total points
ID: 34946119
vsuripeddi - All done using simple excel formulae.

Patrick - My numbers are different to yours. Please review. Eg - Is Project D supposed to have 0 cost?

File is attached. I have calculated cost of each project each month using sumif()'s, then have totaled them for output.

 PROJ-SALES-NP.xls
0
 
LVL 1

Expert Comment

by:dev00790
ID: 34946139
Ok I understand now. Let me work through it.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34946296
vsuripeddi,

Apologies there were errors in my formulae. It's now all done with simple formulae in the attached file.

eg:

=SUMPRODUCT((MONTH($B$1:$M$1)>=B26)*(MONTH($B$1:$M$1)<=C26)*($A$2:$A$18=A26)*$B$2:$M$18)

Patrick
PROJ-SALES-03.xls
0
 
LVL 1

Expert Comment

by:dev00790
ID: 34946781
Atttached is my spreadhsheet earlier, but now included VBA macro to fill in Quarters for you.
Just press the grey button in file.

Hope that one of the two helps!

dev00790. PROJ-SALES-NP.xls
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34946818
vsuripeddi,

Perhaps one of the advantages of using SUMPRODUCT() is that no VBA is needed and it is quick to set up.

Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34946909
vsuripeddi,

I have changed the formulae in the attached file so that you can still specify Quarters for the start and finish and the formula can translate those into start and finish months. It's in the attached file. The formula now has the format as follows:

=SUMPRODUCT((MONTH($B$1:$M$1)>=HLOOKUP(B26,{"Q1","Q2","Q3","Q4";1,4,7,12},2,0))*(MONTH($B$1:$M$1)<=HLOOKUP(C26,{"Q1","Q2","Q3","Q4";1,4,7,12},2,0))*($A$2:$A$18=A26)*$B$2:$M$18)

It looks complicated but in fact it isn't really. It's great advantage is that no VBA is needed and no changes are needed to the data on the worksheet.

Patrick
PROJ-SALES-04.xls
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34962419
vsuripeddi,

Did you have time to look at my formula only solution in comment ID:34946909?

Patrick
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question