If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Summing duplicate values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-10-06, 15:07
tasha123 tasha123 is offline
Registered User
 
Join Date: Dec 2005
Posts: 67
Summing duplicate values

Hi Pls help. I am trying to write a sum function which compares values down a column and then adds values from another column if there are more than one. The formula I wrote works for 2 identical values but not for more than that. I'll copy my formula to make it clearer:

=IF(A2=A3, A2+A3, "").

This works if A2 and A3 are duplicated but does not work if there are more than 2. How can I get round this? Does anyone know how I can write it in VBA if it can't be done as a pure function?
Reply With Quote
  #2 (permalink)  
Old 02-13-06, 00:50
Fazza Fazza is offline
Registered User
 
Join Date: Feb 2006
Posts: 113
Tasha,

The requirement is not at all clear to me - and, the example is not consistent with the description (doesn't refer to a different column).

Please post again with a clearer description and a better example.

regards,
Fazza
Reply With Quote
  #3 (permalink)  
Old 02-16-06, 06:10
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Quote:
Originally Posted by tasha123
Hi Pls help. I am trying to write a sum function which compares values down a column and then adds values from another column if there are more than one. The formula I wrote works for 2 identical values but not for more than that. I'll copy my formula to make it clearer:

=IF(A2=A3, A2+A3, "").

This works if A2 and A3 are duplicated but does not work if there are more than 2. How can I get round this? Does anyone know how I can write it in VBA if it can't be done as a pure function?
is it something like this you are after (this is just a guess at what is required)

=SUMPRODUCT(--($A$2:$A$13=$A2)*($B$2:$B$13))

give it a try and see if it does what you need if not as fazza sed youll need to be clearer

All the Best
Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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