View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
UKMAN UKMAN is offline
external usenet poster
 
Posts: 70
Default sum a value depending on the value of a cell??

Max,

Sorry did as you said and didn't quite work out. if you email me at ukman1
at hotmail com then I can send you an example if that helps?

cheers


"Max" wrote:

This set-up should deliver all of it for you ..

In A5:
=IF(A3="","",IF(COUNTIF($A$3:A3,A3)1,"",COLUMNS($ A:A)))
Copy A5 to AE5

In AH4:
=IF(COLUMNS($A:A)COUNT($A$5:$AE$5),"",INDEX($A$3: $AE$3,SMALL($A$5:$AE$5,COLUMNS($A:A))))

In AH5:
=IF(AH3="","",SUMIF($A$3:$AE$3,AH3,$A$4:$AE$4))
Select AH4:AH5, copy across by 31* cols to BL5, to cover the max possible
extent.

You will get the required results in AH4:BL5, ie the unique listing of the
variables in AH4:BL4 (with results neatly bunched to the left), and the
corresponding sums for each variable below.

*if as you say, there are only a max of 10 possible variables, then just
copy across by 10 cols to AQ5 will do.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"UKMAN" wrote:
Max, I think I understand your brilliance... but I think I may need to give
another example to clarify. sorry.

Imagine a calendar with its 31 days (a3-ae3) horizontal showing 1 of 10
variables i.e B, B.5, T
In row a4-ae4 with be a changing cost i.e £2.50 for the above cell.

1
2 a b c d e f g
3 B T B B B.5 B.5 B
4 2.5 2.0 1.8 2.0 1.25 1 3.0

What I am trying to do is calculate in cells ah4, ai4 etc is total sum of
the costs for each the variables i.e. in the above exampl B=9.3, T=2, B.5=2.25

I hope this example shows it more clearly and many thanks.