# Countif with Concatenate not working properly

1. ## Countif with Concatenate not working properly

Hi folks,

I am trying to use the following formula to count the number of "W" values in a range - simple example below.

=COUNTIF('Raw Data'!C55:C57,"W")

But i want to C57 part of the range to be dynamic, based on a header date.

Basically i want to the range to be built like this - the MATCH formula below returns a row number; say 57.

CONCATENATE("'Raw Data'!C55:", "C", MATCH(D5,'Raw Data'!\$B:\$B,0))

So I am using the following formula to get it.

=COUNTIF(CONCATENATE("'Raw Data'!C55:", "C", MATCH(D5,'Raw Data'!\$B:\$B,0)),"W")

But i keep getting "We found a problem with this formula" error.

For info the following formula succesffuly returns 'Raw Data'!C55:C57

=CONCATENATE("'Raw Data'!C55:", "C", MATCH(F5,'Raw Data'!\$B:\$B,0))

So it seems to be the connect with the Countif formula.

Am i doing something wrong with the syntax?

2. ## Re: Countif with Concatenate not working properly

You need to use the INDIRECT function to convert the string which represents a range reference into an actual reference that Excel can make use of. Try it this way:

=COUNTIF(INDIRECT("'Raw Data'!C55:C" & MATCH(D5,'Raw Data'!\$B:\$B,0)),"W")

Hope this helps.

Pete

3. ## Re: Countif with Concatenate not working properly

Pete - you are a wee star!

Thanks!

4. ## Re: Countif with Concatenate not working properly

You're welcome - glad to help.

Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

Pete

5. ## Re: Countif with Concatenate not working properly

Done - Cheers

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1