Note: The other languages of the website are Google-translated. Back to English
登入  \/ 
x
or
x
註冊  \/ 
x

or

如何在Excel中計算單元格是否包含文本或部分文本?

假設您具有以下數據,並且想要計算包含文本“蘋果“,單元格數包含文本“橙色“並且單元格包含”“分別如何完成?在本教程中,我們將解釋 COUNTIF 函數的詳細功能可幫助您快速計算單元格中包含文本或Excel中特定文本一部分的單元數。 此外,我們引入了一項很棒的功能,只需單擊即可輕鬆實現。


使用COUNTIF函數計算單元格是否包含文本或部分文本

COUNTIF函數可以幫助計算Excel中一系列單元格中包含部分文本的單元格。 請執行以下操作。

1.選擇一個空白單元格(例如E5),將以下公式複製到其中,然後按 Enter 鍵。 然後向下拖動“填充手柄”以獲取所有結果。

=COUNTIF(B5:B10,"*"&D5&"*")

句法

=COUNTIF (range, criteria)

參數

  • 範圍 (必填):您要計數的單元格範圍。
  • 標準 (必填):一個數字,表達式,單元格引用或文本字符串,用於確定要對哪些單元格進行計數。

筆記:

  • 在公式中,B5:B10是要計數的單元格範圍。 D5是包含您要查找的內容的單元格引用。 您可以根據需要更改參考單元格和公式中的條件。
  • 如果您想直接在公式中輸入文字進行計數,請應用以下公式:
    =COUNTIF(B5:B10,"*Apple*")
  • 此公式不區分大小寫。

如果單元格包含Excel中的文本或部分文本,則只有幾次單擊可以計數:

選擇特定的單元格 的效用 Kutools for Excel 如果它們包含某些文本或部分文本,可以幫助您快速計算範圍內的單元格數量。 在彈出對話框中獲得結果後,將自動選擇所有匹配的單元格。 點擊查看更多細節.
立即下載Excel的Kutools! (30天免費試用)


計數單元格包含帶有COUNTIF函數的文本

如下面的屏幕截圖所示,如果要計算僅包含文本的特定範圍內的單元格數,則本節中的方法可以為您提供幫助。

1.選擇一個空白單元格以輸出結果,將以下公式複製到其中,然後按 Enter 鍵。

=COUNTIF(B5:B10,"*")


使用Kutools for Excel計算單元格包含文本還是部分文本

小技巧: :除了上述公式之外,這裡還介紹了一個很棒的功能來輕鬆解決此問題。 隨著 選擇特定的單元格 的效用 Kutools for Excel,您可以快速計算單元格包含的是包含點擊的文本還是部分文本。 您甚至可以根據需要使用OR或And條件計數。 請執行以下操作。

在使用之前 Kutools for Excel,您需要花幾分鐘時間 免費下載並安裝 首先。

1.選擇要計算包含特定文本的單元格數量的範圍。

2。 點擊 庫工具 > 選擇 > 選擇特定的單元格.

3。 在裡面 選擇特定的單元格 對話框,您需要:

  • 選擇 細胞 在選項 選擇類型 部分;
  • 特定類型 部分,選擇 包含 在下拉列表中,輸入 蘋果 在文本框中
  • 點擊 OK 按鈕。
  • 然後會彈出一個提示框,告訴您有多少個符合條件的單元格。 點擊 OK 按鈕,並同時選擇所有合格的單元格。

 小費。 如果您想免費試用(60天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


相關文章

在Excel中將countif與多個條件一起使用
在Excel中,COUNTIF函數可以幫助我們計算列表中某個值的數量。 但是有時,我們需要使用多個條件進行計數,這將更加複雜。 本教程將向您展示實現它的方法。
點擊了解更多...

計算Excel中單元格是否以特定文本開頭或結尾
假設您有一系列數據,並且要計算工作表中以“ kte”開頭或以“ kte”結尾的單元格的數量。 本文介紹了一些技巧,而不是為您手動計數。
點擊了解更多...

計算多個工作表中的特定值
您如何在多個工作表中計算特定值? 例如從多個工作表中獲取特定值“ Excel”的出現次數。 本教程介紹了完成任務的方法。
點擊了解更多...


演示:使用Kutools for Excel計算單元格是否包含文本或部分文本



  • 超級公式欄 (輕鬆編輯多行文本和公式); 閱讀版式 (輕鬆讀取和編輯大量單元格); 粘貼到過濾範圍...
  • 合併單元格/行/列 和保存數據; 拆分單元格內容; 合併重複的行和總和/平均值...防止細胞重複; 比較範圍...
  • 選擇重複或唯一 行; 選擇空白行 (所有單元格都是空的); 超級查找和模糊查找 在許多工作簿中; 隨機選擇...
  • 確切的副本 多個單元格,無需更改公式參考; 自動創建參考 到多張紙; 插入項目符號,複選框等...
  • 收藏并快速插入公式,範圍,圖表和圖片; 加密單元 帶密碼 創建郵件列表 並發送電子郵件...
  • 提取文字,添加文本,按位置刪除, 刪除空間; 創建和打印分頁小計; 在單元格內容和註釋之間轉換...
  • 超級濾鏡 (將過濾方案保存並應用於其他工作表); 高級排序 按月/週/日,頻率及更多; 特殊過濾器 用粗體,斜體...
  • 結合工作簿和工作表; 根據關鍵列合併表; 將數據分割成多個工作表; 批量轉換xls,xlsx和PDF...
  • 數據透視表分組依據 週號,週幾等 顯示未鎖定的單元格 用不同的顏色 突出顯示具有公式/名稱的單元格...
kte選項卡201905
  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 每天將您的工作效率提高50%,並減少數百次鼠標單擊!
officetab底部
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Jan · 1 years ago
    Did someone check this on Macintosh? Im struggeling in Excel365, and cant get a substring to count. Something with using the asteric on the Mac? That blows!
  • To post as a guest, your comment is unpublished.
    lacristein@gmail.com · 2 years ago
    EXCELENTE MUCHAS GRACIAS!!!! ME SIRVIÓ DE MUCHO!!!!
  • To post as a guest, your comment is unpublished.
    Bala · 2 years ago
    Want to countif

    How many apple text in row2 when row 3 is apple farm
  • To post as a guest, your comment is unpublished.
    bubie · 2 years ago
    hi tolong. macam mana ni?
  • To post as a guest, your comment is unpublished.
    Brian · 2 years ago
    Okay, what if I want to do a countif on a specific position in the cell. I'm looking for an 'r' in the third character following a '-' in the cell. So in English count only cells where the third character following the dash ('-') is an 'r'.
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi Brian,
      Sorry can't help you with that yet.
  • To post as a guest, your comment is unpublished.
    Renee · 3 years ago
    Hi,
    needing help please, i need this to do count over 33 work sheets with the same name. this is what i tried to start with =COUNTIF( "1 - 33'!,"*Bosch MIC 7000i IP7230 1080p*") - but no go. the 1 - 33 is the number range of spreadsheet names.

    How ever this is where it gets trickier.
    i need it to also include the totals in the individual spread sheet - name of product / part number and supplier....
    so simple hahahaha
    • To post as a guest, your comment is unpublished.
      crystal · 2 years ago
      Hi Renee,
      Thank you for sharing it.
  • To post as a guest, your comment is unpublished.
    Tresa · 3 years ago
    Is there a way to use the COUNTIF function but rather than typing in the word to count, the formula can look at another cell where the user could type the name into the cell and the cell next to it (with the COUNTIF function) will show how many time the typed in date is in the worksheet?
    • To post as a guest, your comment is unpublished.
      Honza · 3 years ago
      Yes, I've just used it. Assuming the cell where you type this word is C1, the syntax would be following: =COUNTIF(A2:A6,"*"&C1&"*"). Also works with SUMIF, you just add the third condition (sum range).
  • To post as a guest, your comment is unpublished.
    No · 3 years ago
    Thank you!
  • To post as a guest, your comment is unpublished.
    ravikumar · 3 years ago
    Dear Crystal ,

    Please find this Excel ..


    i cannot solve this ...


    My Problem is i want to show yes or no for column J reached 80 % (subtotal) other wise highlight the cell untill reached 80% of the total .and also give me the formula for the same.


    thanks a lot for your quick reply.
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Dear ravikumar,
      Sorry for reply so late. I still can't find your uploaded file. Is there something wrong while uploading?
      You can send it to my email address: zxm@addin99.com or post your question to our forum: https://www.extendoffice.com/forum.html to get more Excel supports from our professional.
  • To post as a guest, your comment is unpublished.
    ravikumar · 3 years ago
    please find this picture and tell me the formula for count by name but remember vin is same or multiple entries done in the same vin ..so please tell me i want to count how many vin my no is +91 8655315561 or whats app me its urgent
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Good Day,
      Haven't seen your picture. Please upload it with the below Upload files button.
  • To post as a guest, your comment is unpublished.
    rajesh · 3 years ago
    in the column A employee name is written and in column B car number is written and c column accessories amount is written ..etc


    i want count a how many car is billed with accessories in front of their name ...


    i want formula for count function i tried many function but unable to find it ...so please give me solution for this.
  • To post as a guest, your comment is unpublished.
    JoAnn · 3 years ago
    The formula only seems to work if the word I'm counting is the FIRST word in the cell. How do I count the number of cells that CONTAIN that word, whetheror not it's at the beginning of the cell?
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Dear JoAnn,
      Thank you for your comment. The formula =COUNTIF(A2:A6,"*Apple*") can count the number of cells that contain the word Apple no matter which position it loactes in the cell. Please don't forget to enbrace the word with asterisks.
  • To post as a guest, your comment is unpublished.
    K · 3 years ago
    Hi,


    I have want to count the number of cells which has 2 specific words.

    Example, I have cells which may contain up to 6 words separated by a comma.

    Example:

    A1: banana,apple,orange
    A2: apple,orange,pineapple
    A3: pineapple,banana,guava
    A4: apple,banana,guava
    A5: orange,guava,pineapple
    A6: apple,guava,orange


    I want to count how many cells contain the words Apple AND Orange.


    In the above case, count would be 3


    Please Help, thanks


    K
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Good Day,
      As the problem you mentioned, please try this array formula =SUM(--(IF((LOWER(LEFT(TRIM(A1:A6),LEN("apple")+1))="apple,"),TRUE,IF(LOWER(RIGHT(TRIM(A1:A6),LEN("apple")+1))=",apple",TRUE,(IF(ISERR(SEARCH(",apple,",TRIM(A1:A6))),FALSE,TRUE))))*IF((LOWER(LEFT(TRIM(A1:A6),LEN("orange")+1))="orange,"),TRUE,IF(LOWER(RIGHT(TRIM(A1:A6),LEN("orange")+1))=",orange",TRUE,(IF(ISERR(SEARCH(",orange,",TRIM(A1:A6))),FALSE,TRUE)))))) + Ctrl + Shift + Enter
  • To post as a guest, your comment is unpublished.
    Moataz · 3 years ago
    i have excel sheet containing 3 columns (Section / Name / Gender)
    what formula can count how many "male" or "female" in very section
    • To post as a guest, your comment is unpublished.
      crystal · 3 years ago
      Dear Moataz,
      Would you please provide a screenshot of your spreadsheet showing what you are exactly trying to do?
  • To post as a guest, your comment is unpublished.
    SUSH · 4 years ago
    I HAVE TO COUNT THE TOTAL CELL WHICH CONTAINS A NAME AND NUMBER, SO HOW TO COUNT NAMES AND NUMBERS IN EXCEL EX. CELL A1:A5 CONTAINS APPLE 2143 BALL 5431 CAT TELL ME HOW TO COUNT IT
    • To post as a guest, your comment is unpublished.
      Vvv · 3 years ago
      =COUNTIF(A1:A5,"APPLE")


      Sorry I am not sure I got your question. Would be nice if you could provide screenshot of what you are trying to do..
      • To post as a guest, your comment is unpublished.
        KyleM · 3 years ago
        Your response doesn't quite work, you must include * around the text you're searching. ie =countif(A1:A5, "*apple*")
      • To post as a guest, your comment is unpublished.
        Kyle · 3 years ago
        Your response does not work in this scenario.
  • To post as a guest, your comment is unpublished.
    Graham · 4 years ago
    Hi,

    Great tutorials.

    This is just what I have been trying to do, however with one exception.

    What I need to do is instead of search and count for a cell that contains apple I need it to search to see if the cells contain the contents of a another cell with wildcard.

    Currently using COUNTIF(I$8:O$30,B36) which is on the most part doing the job. Cell B36 will contain 2 or the initials, eg GP or TV, which works fine but what I need to do is count if the cells contains GP when cell b36 contains GP/TV.

    The formula COUNTIF(I$8:O$30,B36) does not then pick up and count that cell because it is not just GP.

    I know I could use =COUNTIF(A2:A6,"*GP*") however the cell for the code has 52 if commands in it and is repeated on 37 rows so its not ideal to use that.

    Can it be done?

    Thanks for looking
    • To post as a guest, your comment is unpublished.
      Luke · 3 years ago
      Graham, did you ever find a way to do this please? As I'm currently trying to find a way to do the exact same thing.

      Thank you
      • To post as a guest, your comment is unpublished.
        Asger T.P. · 3 years ago
        If we take Graham's example, then you can write: COUNTIF(I$8:O$30,"*"&B36&"*").

        Hope this helps :)
      • To post as a guest, your comment is unpublished.
        KyleM · 3 years ago
        When using =countif(s) you can use * around the specific text you're trying to look for in a statement. For example, I was looking to count cells where they had the word "ran" in them, when they would be vastly different entries. There would be such things as "ran off road", "animal hit/ran off road", "overturn/ran off road".

        So I did basically =countif(range, "*ran*") and it works fine. Hope this helps?
      • To post as a guest, your comment is unpublished.
        Kyle M · 3 years ago
        When using =countif(s) you can use * around the text you're trying to look for in a statement. For example, I was looking to count cells where they had the word "ran" in them, when they would be vastly different entries. There would be such things as "ran off road", "animal hit, ran off road", "overturn, ran off road".

        So I did basically =countif(range, "*ran*") and it works fine. Hope this helps?
    • To post as a guest, your comment is unpublished.
      Vvv · 3 years ago
      What i did before was place the this code: (=COUNTIF(A2:A6,"*GP*")) on 1 cell and another formula in another cell, then just click =SUM on the 2 cells with the code.
      • To post as a guest, your comment is unpublished.
        Tony · 3 years ago
        Try =COUNTIF(I$8:O$30,"="&"*"&B36&"*")
        • To post as a guest, your comment is unpublished.
          J · 3 years ago
          This worked for me, except I don't want it count if the cell is blank. Any suggestions?