Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Excel - Calculating quantities in a hierarchy

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Excel - Calculating quantities in a hierarchy

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Excel - Calculating quantities in a hierarchy

Thank you Sheeloo. That was extremely helpful. The first example was exactly
what I was looking for. The only problem is, I want the sum function to stop
when it hits a level that is equal or higher than the level on the current
line. Is that possible?

"Sheeloo" wrote:

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Excel - Calculating quantities in a hierarchy

If you have cost for two products and you want to sum for levels separately
for product A and B then you have to introduce the Col for product also in
the SUMPRODUCT formula...

Once you udnerstand the formula then you can build it yourself

=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
what the above does is find the rows where cell value in Col A is greater
than D1 AND cell value in Col B is equal to "C" and sum the values in Col C
for those rows...
A1:A100D1 give your TRUE or FALSE. -- in front converts them to 1 and 0...
Essentailly SUMPRODUCT multiplies the values it gets for each set within it...

Since you get 0 when conditions are not met 0 is added for those rows and
acutal values for others.

Hope this makes sense..

Let me know if you need further help.
"mmccoog" wrote:

Thank you Sheeloo. That was extremely helpful. The first example was exactly
what I was looking for. The only problem is, I want the sum function to stop
when it hits a level that is equal or higher than the level on the current
line. Is that possible?

"Sheeloo" wrote:

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Excel - Calculating quantities in a hierarchy

Sorry, I meant I want it to stop when it hits a level that is equal or lower
than the current line. So when it's on the first level 1, it will sum all the
level 2 lines but stop when it gets to the next level 1. Does that make sense?

"Sheeloo" wrote:

If you have cost for two products and you want to sum for levels separately
for product A and B then you have to introduce the Col for product also in
the SUMPRODUCT formula...

Once you udnerstand the formula then you can build it yourself

=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
what the above does is find the rows where cell value in Col A is greater
than D1 AND cell value in Col B is equal to "C" and sum the values in Col C
for those rows...
A1:A100D1 give your TRUE or FALSE. -- in front converts them to 1 and 0...
Essentailly SUMPRODUCT multiplies the values it gets for each set within it...

Since you get 0 when conditions are not met 0 is added for those rows and
acutal values for others.

Hope this makes sense..

Let me know if you need further help.
"mmccoog" wrote:

Thank you Sheeloo. That was extremely helpful. The first example was exactly
what I was looking for. The only problem is, I want the sum function to stop
when it hits a level that is equal or higher than the level on the current
line. Is that possible?

"Sheeloo" wrote:

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Excel - Calculating quantities in a hierarchy

Which level is highest 1 or 4?
Do you have level 1s first then level 2s or you have level 1 then level2,..
and then this pattern repeats...?

You can adjust your range and/or conditions to get what you want. If you can
tell us in detail then we can provide a formula.

"mmccoog" wrote:

Sorry, I meant I want it to stop when it hits a level that is equal or lower
than the current line. So when it's on the first level 1, it will sum all the
level 2 lines but stop when it gets to the next level 1. Does that make sense?

"Sheeloo" wrote:

If you have cost for two products and you want to sum for levels separately
for product A and B then you have to introduce the Col for product also in
the SUMPRODUCT formula...

Once you udnerstand the formula then you can build it yourself

=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
what the above does is find the rows where cell value in Col A is greater
than D1 AND cell value in Col B is equal to "C" and sum the values in Col C
for those rows...
A1:A100D1 give your TRUE or FALSE. -- in front converts them to 1 and 0...
Essentailly SUMPRODUCT multiplies the values it gets for each set within it...

Since you get 0 when conditions are not met 0 is added for those rows and
acutal values for others.

Hope this makes sense..

Let me know if you need further help.
"mmccoog" wrote:

Thank you Sheeloo. That was extremely helpful. The first example was exactly
what I was looking for. The only problem is, I want the sum function to stop
when it hits a level that is equal or higher than the level on the current
line. Is that possible?

"Sheeloo" wrote:

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Excel - Calculating quantities in a hierarchy

The file starts at level 1 and can go down as low as level 7, then another
level 1. Something like this:
1
2
3
3
2
3
4
1
2
3

"Sheeloo" wrote:

Which level is highest 1 or 4?
Do you have level 1s first then level 2s or you have level 1 then level2,..
and then this pattern repeats...?

You can adjust your range and/or conditions to get what you want. If you can
tell us in detail then we can provide a formula.

"mmccoog" wrote:

Sorry, I meant I want it to stop when it hits a level that is equal or lower
than the current line. So when it's on the first level 1, it will sum all the
level 2 lines but stop when it gets to the next level 1. Does that make sense?

"Sheeloo" wrote:

If you have cost for two products and you want to sum for levels separately
for product A and B then you have to introduce the Col for product also in
the SUMPRODUCT formula...

Once you udnerstand the formula then you can build it yourself

=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
what the above does is find the rows where cell value in Col A is greater
than D1 AND cell value in Col B is equal to "C" and sum the values in Col C
for those rows...
A1:A100D1 give your TRUE or FALSE. -- in front converts them to 1 and 0...
Essentailly SUMPRODUCT multiplies the values it gets for each set within it...

Since you get 0 when conditions are not met 0 is added for those rows and
acutal values for others.

Hope this makes sense..

Let me know if you need further help.
"mmccoog" wrote:

Thank you Sheeloo. That was extremely helpful. The first example was exactly
what I was looking for. The only problem is, I want the sum function to stop
when it hits a level that is equal or higher than the level on the current
line. Is that possible?

"Sheeloo" wrote:

Your question is not clear, however
Assuming your Levels are in Col A, indicated by 1,2,3,4
Col B indicates whether it is a cost by "C" and Sum by "S"
and you have acutal values in Col C,
then you can sum up cost at a given level
=SUMPRODUCT(--(A1:A100=D1),--(B1:B100="C"),(C1:C100))

where D1 contains the level (1,2 ,3 or 4)

If you want to sum level 3 AND 4 then you can have
=SUMPRODUCT(--(A1:A100D1),--(B1:B100="C"),(C1:C100))
with D2 having the value 2


"mmccoog" wrote:

Hello,
I have a rather complex question but limited experience with excel. I have a
family tree type of file and need to calculate costs based on the lower level
costs.
Example:
Level 1 AAAA sum of levels 2 ($17)
Level 2 BBBB $5
Level 2 CCCC sum of levels 3 ($12)
Level 3 DDD sum of level 4 ($5)
Level 4 EEE $5
Level 3 FFF $7

Each record has the level code and an indicator to tell if it's a sum or if
it has the cost. I'm able to do this manually but the files can become large
and this takes a while to process, level by level. Hopefully this make sense
and there's an easy way to do this.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hierarchy table Derrick Excel Discussion (Misc queries) 1 October 31st 08 01:53 AM
Displaying Excel data in flattened hierarchy Nagesh Excel Worksheet Functions 1 May 31st 07 07:53 AM
Need ActiveX hierarchy. Sreekar Excel Discussion (Misc queries) 0 November 13th 06 09:34 PM
Hierarchy in excel jamshaggy Excel Discussion (Misc queries) 1 July 23rd 06 08:05 PM
Hierarchy in excel jamshaggy New Users to Excel 1 July 23rd 06 06:49 PM


All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"