Count formula with condition

Muhammad Asif 121 Reputation points
2022-11-02T08:06:09.04+00:00

I have an Excel sheet and want to count cell B value with the condition of Cell A.
for example, I have data like that
cell A cell B cell C
Google 1 Google
Google 1
Facebook 1
how am use a formula to count google values in the entire sheet and also Facebook values with the required condition?
when cell c1 is equal to google it compare the value of cell C with cell A and count all value of cell B of Google.

Microsoft 365 and Office | Excel | For business | Windows
{count} votes

Answer accepted by question author
  1. Emi Zhang-MSFT 30,126 Reputation points Microsoft External Staff
    2022-11-03T07:20:43.943+00:00

    Hi @Muhammad Asif ,
    Do you want to SUM the values in cell B?
    You can try this formula:

    =SUMPRODUCT(($A$1:$A$3=C1)*($B$1:$B$3))  
    

    256630-image.png

    If you want to Count the values in cell B, try this formula:

    =SUMPRODUCT(($A$1:$A$3=C1)*(B1:B3>0)*1)  
    

    256696-image.png

    Just checking in to see if the information was helpful. Please let us know if you would like further assistance.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2025-07-27T01:48:48.3466667+00:00

    Hi,

    Try this formula

    =groupby(A2:A4,B2:B4,SUM)

    Hope this helps.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.