+ Reply to Thread
Results 1 to 12 of 12

How to countif to partial text

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    How to countif to partial text

    Is there a way to do a COUNTIF on just partial text?

    I know how to count how many cells in a column contain the text "cars" for example, but how would i write a formula that include cells with other text as well?

    For example if 55 cells have "cars" as a value
    and 20 cells have "fast cars" as a value

    I would want the formula to count 75.

    Basically, it needs to count how many cells cars appears in, in a specific column, regardless of whether its alone in the cell or part of a sentence.

    Thanks!
    Attached Files Attached Files
    Last edited by ks100; 12-19-2013 at 03:46 PM.

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: How to countif to partial text

    Try:

    Please Login or Register  to view this content.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: How to countif to partial text

    Quote Originally Posted by ConneXionLost View Post
    Try:

    Please Login or Register  to view this content.
    Thanks, now how would I incorporate that to instead of referring to all of column A, refer to all of column (INDEX MATCH "Vehicles") ?

    So basically, it is finding the "Vehicles" column, wherever that may be on the spreadsheet, and performing the count.

  4. #4
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: How to countif to partial text

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to countif to partial text

    Something like this...

    =COUNTIF(INDEX(A:D,0,MATCH("Vehicles",A1:D1,0)),"*Cars*")

    Where Vehicles is a column header somewhere in the range A1:D1.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: How to countif to partial text

    Quote Originally Posted by Tony Valko View Post
    Something like this...

    =COUNTIF(INDEX(A:D,0,MATCH("Vehicles",A1:D1,0)),"*Cars*")

    Where Vehicles is a column header somewhere in the range A1:D1.
    Got it, what if the headers are some times in row 3 or 4? What would the range become, A1:D4?

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to countif to partial text

    I think it's time to post a sample file so we can see what we're dealing with.

  8. #8
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: How to countif to partial text

    Quote Originally Posted by Tony Valko View Post
    I think it's time to post a sample file so we can see what we're dealing with.
    Ok updated with a sample. Each sheet of the sample shows a possible location for the header. The code you gave me worked Tony, however I am looking to modify it to detect if the header is as far down as row 4.

    Thanks

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to countif to partial text

    Well, that makes it a lot more complicated.

    Assuming the column header "Vehicles" will be within the range A1:H4.

    Try this array formula**:

    =COUNTIF(OFFSET(INDIRECT(ADDRESS(MAX(IF(A1:H4="Vehicles",ROW(A1:H4))),MAX(IF(A1:H4="Vehicles",COLUMN(A1:H4))),4)),0,0,100),"*Cars*")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Change the 100 to reflect the number or rows of data that you think you will have or need.
    Last edited by Tony Valko; 12-18-2013 at 05:40 PM.

  10. #10
    Forum Contributor
    Join Date
    05-07-2013
    Location
    apple valley ca
    MS-Off Ver
    Excel 2007
    Posts
    110

    Re: How to countif to partial text

    =SUMPRODUCT(--ISNUMBER(SEARCH({cell where the search name is },A1:A100)))

    and the a1:100 is the cells where it is looking the partial name at

    look at example sheet 1
    Attached Files Attached Files
    Last edited by xwarlock10x; 12-18-2013 at 06:36 PM.

  11. #11
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: How to countif to partial text

    Quote Originally Posted by Tony Valko View Post
    Well, that makes it a lot more complicated.

    Assuming the column header "Vehicles" will be within the range A1:H4.

    Try this array formula**:

    =COUNTIF(OFFSET(INDIRECT(ADDRESS(MAX(IF(A1:H4="Vehicles",ROW(A1:H4))),MAX(IF(A1:H4="Vehicles",COLUMN(A1:H4))),4)),0,0,100),"*Cars*")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Change the 100 to reflect the number or rows of data that you think you will have or need.
    It works, however with an odd glitch. If the actual array formula is posted anywhere in the rows its "searching" it forms a circular reference and won't calculate. To remedy this, I am going to try:

    Please Login or Register  to view this content.
    And insert the array in the A column. I will see if that works.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to countif to partial text

    Yes, you would have to put the formula outside of any ranges it refers to.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. matching partial text within one cell to partial text within another
    By Solstice in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-03-2010, 09:13 PM
  2. COUNTIF for a partial value
    By Jonah in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  3. COUNTIF for a partial value
    By Jonah in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  4. [SOLVED] COUNTIF for a partial value
    By Jonah in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  5. [SOLVED] COUNTIF for a partial value
    By Jonah in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-03-2005, 09:05 AM

Bookmarks

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