#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default CountIf - mid()

Hi, I am trying to get this countif function to work with the mid
function and can't seem to get it to count more than 1 instance. Here
is my formula below. The result that should be returned is 22, and
it's returning 1. Any help would be appreciated.

=COUNT(IF(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2),'[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269))

Also, I looked at other posts and couldn't seem to get any of the
solutions to work with my case.

Thanks for your help,
Brian
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default CountIf - mid()

Try it this way:

=SUM(IF(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2),1,0))

Note that this is an array formula, which means that you have to
commit it using the key combination of CTRL-SHIFT-ENTER (CSE) instead
of the usual <Enter. If you do this correctly then Excel will wrap
curly braces { } around the formula when viewed in the formula bar -
you should not type these yourself. If you subsequently amend or edit
the formula you need to use CSE again.

Another way which does not need to be array-entered is:

=SUMPRODUCT(--(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269))

Hope this helps.

Pete

On Mar 18, 12:33*pm, Bongard wrote:
Hi, I am trying to get this countif function to work with the mid
function and can't seem to get it to count more than 1 instance. Here
is my formula below. The result that should be returned is 22, and
it's returning 1. Any help would be appreciated.

=COUNT(IF(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2),'[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269))

Also, I looked at other posts and couldn't seem to get any of the
solutions to work with my case.

Thanks for your help,
Brian


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default CountIf - mid()


Hi, try
=sumproduct((MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2)=t26)*('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269))

Bongard;274543 Wrote:
Hi, I am trying to get this countif function to work with the mid
function and can't seem to get it to count more than 1 instance. Here
is my formula below. The result that should be returned is 22, and
it's returning 1. Any help would be appreciated.

=COUNT(IF(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2),'[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269))

Also, I looked at other posts and couldn't seem to get any of the
solutions to work with my case.

Thanks for your help,
Brian



--
Pecoflyer

Cheers -
*'Membership is free' (http://www.thecodecage.com)* & allows file
upload -faster and better answers

*Adding your XL version* to your post helps finding solution faster
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=76556

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default CountIf - mid()

=countif() and =sumif() won't work when the sending workbook is closed (as
you've seen).

Another option is to use =sumproduct():

=sumproduct(--(T26
=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269,5,2))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html

======
(You don't need to array enter (ctrl-shift-enter) this =sumproduct() formula.)

Bongard wrote:

Hi, I am trying to get this countif function to work with the mid
function and can't seem to get it to count more than 1 instance. Here
is my formula below. The result that should be returned is 22, and
it's returning 1. Any help would be appreciated.

=COUNT(IF(T26=MID('[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A
$269,5,2),'[PriceToSales_Download.xls]CS (1M) - Q'!$A$5:$A$269))

Also, I looked at other posts and couldn't seem to get any of the
solutions to work with my case.

Thanks for your help,
Brian


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default CountIf - mid()

Thank you guys for your suggestions. I ended up wanting to make the
formula more dynamic so I added a named range as well. The formula
that I have working for me is the following: =SUMPRODUCT(--(MID(TEXT
(AlphaTestRange,"00"),5,2)=TEXT($T26,"00")))
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
How do I use a countif function according to two other countif fu. Kirsty Excel Worksheet Functions 2 February 20th 06 11:44 AM
edit this =COUNTIF(A1:F16,"*1-2*")+COUNTIF(A1:F16,"*2-1*") sctroy Excel Discussion (Misc queries) 2 September 25th 05 04:13 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
Countif DG Excel Worksheet Functions 6 June 30th 05 08:25 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM


All times are GMT +1. The time now is 02:46 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"