+ Reply to Thread
Results 1 to 5 of 5

(FORMULA) Countif the cell contains the text from another cell

  1. #1
    Registered User
    Join Date
    10-20-2014
    Location
    SG
    MS-Off Ver
    2010
    Posts
    13

    (FORMULA) Countif the cell contains the text from another cell

    Hi everyone

    I'm relatively new to excel and i am facing a problem:

    In sheet 1-
    cell A1 contains "APPLE & PIE"
    cell A2 contains " APPLE & PIE"
    Cell A3 contains "APPLE & PIE "

    In sheet 2-
    cell A1 contains " APPLE & PIE " ([space] APPLE & PIE [Space])
    i would like to count the number of cells containing the text in sheet 2's A1. i've tried "COUNTIF" formula but the answer shows 0 due to the difference in the formatting of the texts in cells A1-A3(some with spaces in front, while some with spaces behind).

    Is there a way to go about doing this?

    Thank you in advance!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: (FORMULA) Countif the cell contains the text from another cell

    Hi, welcome to the forum

    From the sounds of it, you have Apple Pie repeated in sheet2 cells, but only once in sheet1 cells? If so, then if you base your coung on sheet2 (with double the text), and try and count the matches in sheet1, you will get 0 because excel is trying to match the exact contents of sheet2 with the exact contents of the cells in sheet1, and of course, there is no exact match.

    hmm wait, maybe I read that wrong, and you were trying to show the spaces?
    If so, try using the TRIM() command....
    =COUNTIF(Sheet1!$A$1:$A$7,trim(A1))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: (FORMULA) Countif the cell contains the text from another cell

    Hi, One way

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This can be used for irregular spaces, basically it will take out all the spaces & count
    Last edited by boopathiraja; 10-20-2014 at 11:57 PM. Reason: Clarification
    Click just below left if it helps, Boo?ath?

  4. #4
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: (FORMULA) Countif the cell contains the text from another cell

    Hi, Ref the attachment
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-20-2014
    Location
    SG
    MS-Off Ver
    2010
    Posts
    13

    Re: (FORMULA) Countif the cell contains the text from another cell

    Hi there!

    Thanks so much for the prompt reply, your formula worked GREAT

    Thank you so so much!

+ 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. [SOLVED] Count # of times text appears in cell range by cell referencing not =countif(A:A, ="text")
    By smit.etha in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-20-2014, 04:09 AM
  2. [SOLVED] Enter formula result from one cell into a COUNTIF formula in another cell. Help please!
    By gregrach in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 11:23 AM
  3. [SOLVED] countif formula changes cell values and cell reference is unchanged
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-24-2014, 11:37 AM
  4. Formula to identify part of a text in cell from range of cells & insert adjacent cell text
    By Novicebutnotforlong in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-19-2013, 02:11 AM
  5. [SOLVED] Countif cell contains this text string, cell does not have to equal this value exactly.
    By ThomasCarter in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-14-2012, 09:57 AM

Tags for this Thread

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