Forum Discussion

NauNovice's avatar
NauNovice
Copper Contributor
Jan 06, 2019

COUNTIF Formula Help

Hello,

I am fairly new to working with Excel so please forgive me if this is a silly question. I have a set of data values in B2:G20. Let's say in row B20:G20 I have 2 values that match the values in the data set. How can I create a reference formula to count the number of values that appear ( Number of Hits column) in the row that match with the data set? 

 

 

 

 

 

 

I created the following but realized that I need a formula for a value in the data set that changes frequently.

=COUNTIF(B20:G20,"=48") + COUNTIF(B20:G20,"=43") + COUNTIF(B20:G20,"=24") + COUNTIF(B20:G20,"=8") + COUNTIF(B20:G20,"=17")

 

Thank you for any assistance!

  • Willy Lau's avatar
    Willy Lau
    Steel Contributor
    =SUMPRODUCT(COUNTIF(B20:G20,{8,17,24,43,48})) 

     

     

     

    NOTE: hope that it is not used  to check lottery result.

    • NauNovice's avatar
      NauNovice
      Copper Contributor
      Thank you! Looks like I need to dig deeper into understanding arrays. Also no worries about lotto results, losing money is not my thing lol

Resources