Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default compare cells and sum if equal

sheet 2 total1 = sum of sheet1 cell d2 if sheet1 cell b2 = sheet1 cell c2; plus
sum of sheet1 cell d3 if sheet1 cell b3 = sheet1
cell c3; plus
the d2, b2, c2 cells go up to 30 or 40, but the total is the sum of all of
the equals using the number in the c2 thru c30 or c40 cells. example follows:
B C D

XY XY 5
CD SD 21
22 22 10
TOTAL1 = 15 BECAUSE XY=XY AND 22=22. And there can be 30 to 50 columns.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default compare cells and sum if equal

Hi,
Not sure if I understand your question fully, but the following would give
you the answer you want (15) from the sample data:

=SUMPRODUCT(--(A1:A3=B1:B3)*C1:C3)

Change A1:A3, B1:B3 and C1:C3 to suit your actual data.
Note that SUMPRODUCT requires all columns to be of equal length.
Regards - Dave.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default compare cells and sum if equal

Dave, thanks. But I have to change something. Here are the new columns:
A B
ss ss
12
rt dt
2
yh yh
7
Answer=12+7=19. Is there a way to do a range on the compares and the sums
that will not give invalid data checks?

"Dave" wrote:

Hi,
Not sure if I understand your question fully, but the following would give
you the answer you want (15) from the sample data:

=SUMPRODUCT(--(A1:A3=B1:B3)*C1:C3)

Change A1:A3, B1:B3 and C1:C3 to suit your actual data.
Note that SUMPRODUCT requires all columns to be of equal length.
Regards - Dave.

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
Compare two file/colunms, hide row not does not equal list. Jerry New Users to Excel 3 July 21st 07 11:54 PM
how to seperate cells with equal blank cells yaling Excel Discussion (Misc queries) 9 May 13th 07 07:04 PM
compare two text and if equal copy adjacent data Prashanthom Excel Worksheet Functions 1 December 29th 06 03:03 AM
Compare two dates and if they are equal PeterArvidsson Excel Discussion (Misc queries) 1 April 21st 06 02:40 AM
How do I compare cells and if FALSE compare to next cell in EXCEL Cindie Excel Worksheet Functions 0 March 24th 06 05:29 PM


All times are GMT +1. The time now is 11:28 PM.

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

About Us

"It's about Microsoft Excel"