#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default SumProduct

I am trying to look up how many times a person is listed on a
worksheet. They are listed as lastname, column A and first name,
column B. I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. I KNOW everything is
spelled the same and has the same amount of caps. Any ideas of what
is wrong, or how else to run the function?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default SumProduct

What does your formula look like?

It should look like this (of course, adjusting the ranges to your own):

=SUMPRODUCT(--(A1:A100="smith"),--(B1:B100="john"))

Case is not a factor.

It's better to use cells to hold the criteria:

D1 = smith
E1 = john

=SUMPRODUCT(--(A1:A100=D1),--(B1:B100=E1))

Another possible cause is leading/trailing spaces or other unseen
characters.

smith<space
<spacejohn


--
Biff
Microsoft Excel MVP


"tonyalt3" wrote in message
...
I am trying to look up how many times a person is listed on a
worksheet. They are listed as lastname, column A and first name,
column B. I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. I KNOW everything is
spelled the same and has the same amount of caps. Any ideas of what
is wrong, or how else to run the function?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default SumProduct

The most likely culprit is leading or trailing spaces. You can use TRIM()
within a sumproduct to eliminate those spaces

=SUMPRODUCT(--(TRIM(A1:A10)="Bob"))


"tonyalt3" wrote:

I am trying to look up how many times a person is listed on a
worksheet. They are listed as lastname, column A and first name,
column B. I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. I KNOW everything is
spelled the same and has the same amount of caps. Any ideas of what
is wrong, or how else to run the function?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 915
Default SumProduct

tonyalt3 wrote:
I am trying to look up how many times a person is listed on a
worksheet. They are listed as lastname, column A and first name,
column B. I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. I KNOW everything is
spelled the same and has the same amount of caps. Any ideas of what
is wrong, or how else to run the function?


The case (caps, not caps) doesn't matter (try it) however if there are
any leading or trailing spaces in the name the match will fail.
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default SumProduct

On Sep 11, 5:10*pm, smartin wrote:
tonyalt3 wrote:
I am trying to look up how many times a person is listed on a
worksheet. *They are listed as lastname, column A and first name,
column B. *I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. *I KNOW everything is
spelled the same and has the same amount of caps. *Any ideas of what
is wrong, or how else to run the function?


The case (caps, not caps) doesn't matter (try it) however if there are
any leading or trailing spaces in the name the match will fail.


The "trim" suggestion worked. I figured it was a leading or trailing
space, but other than going through each cell to eliminate it I wasn't
sure how to fix. Trim worked. Thanks to all!


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default SumProduct

Hi Tony,

If the names are all single words you could use a Find and Replace command
to remove all the offending spaces. However, if some of the name are like
Mac Murry, where this is the last name, this technique won't work.

You can also flag all the offending cells by using the following conditional
formatting formula:

=LEN(A1)<LEN(TRIM(A1))

Assuming your data starts in cell A1, select that cell and choose Format,
Conditional Formatting, Formula is, and enter the above formula. Click
Format and pick a color on the Pattern tab, click OK twice and copy the
format to any cells.

Cheers,
Shane


--
Thanks,
Shane Devenshire


"tonyalt3" wrote:

On Sep 11, 5:10 pm, smartin wrote:
tonyalt3 wrote:
I am trying to look up how many times a person is listed on a
worksheet. They are listed as lastname, column A and first name,
column B. I've been doing a "sumproduct" function, however for some
reason it doesn't count some individuals. I KNOW everything is
spelled the same and has the same amount of caps. Any ideas of what
is wrong, or how else to run the function?


The case (caps, not caps) doesn't matter (try it) however if there are
any leading or trailing spaces in the name the match will fail.


The "trim" suggestion worked. I figured it was a leading or trailing
space, but other than going through each cell to eliminate it I wasn't
sure how to fix. Trim worked. Thanks to all!

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
Conditional SUMPRODUCT or SUMPRODUCT with Filters Ted M H Excel Worksheet Functions 4 August 14th 08 07:50 PM
Can I use sumproduct for this? joec[_2_] Excel Worksheet Functions 5 February 22nd 08 09:26 AM
Sumproduct Dave Excel Discussion (Misc queries) 2 February 17th 08 07:58 PM
sumproduct? sumif(sumproduct)? David Excel Worksheet Functions 3 July 13th 07 07:06 PM
SUMPRODUCT Help please SamGB Excel Discussion (Misc queries) 11 February 24th 06 11:21 PM


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

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"