View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
KG KG is offline
external usenet poster
 
Posts: 33
Default If statement or Vlookup in a range

Sounds to me like a pivot table would give you what you need. Using SumIf
would probably work too but I think the pivot table would be easier to update.

"keri" wrote:

Hi,

I have a range presented like a table;

ID Cost1 Value1 Cost2
Value2 TotalCost TotalValue

1 50 80 60
90 110 170
5 2000 2200 1000
2300 3000 4500
1 20 40 40
60 60 100
3 10 20 10
20 20 40
2 150 180 160
190 310 370

I want to be able to total all of the values in each colum where the
ID is the same.

Eg. for ID 1 I would like to total all Cost1 values (in this case
return 70), and all value1 values (120). However I could have up to
500 different ID's.

I know how to do an if statement on one line - eg.
=if(a1="1",a2,"")

However I would have to do this on every row for every ID. Is there an
easier way?