Combining CountIF and Vlookup

dhana_ram

New Member
Joined
Oct 2, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi All!

I'm currently trying to find a way to count how many data "high" in each month. Example: I want to count how many "high" data only in month 1, and how many "Low" in month 4.

I've tried =COUNTIF(VLOOKUP(A2,A2:B18,2,0),"HIGH") but it doesn't work.

Does anyone know how to obtain these data?

Thanks alot!
 

Attachments

  • Capture 1.JPG
    Capture 1.JPG
    25.9 KB · Views: 16

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to MrExcel Message Board:
Book1
ABCDEFGHIJKLM
1MonthStockMonthCountMonthStockMonthCount
21Low111/3/2021Low11
31High231/11/2021High23
41Low311/19/2021Low31
51Low421/27/2021Low41
62High522/4/2021High52
72High612/12/2021High62
82Low2/20/2021Low
92High2/28/2021High
103Low3/8/2021Low
113Low3/16/2021Low
123High3/24/2021High
133Low4/1/2021Low
144Low4/9/2021Low
154High4/17/2021High
164Low4/25/2021Low
174High5/3/2021High
185High5/11/2021High
195Low5/19/2021Low
205Low5/27/2021Low
215High6/4/2021High
226Low6/12/2021Low
236Low6/20/2021Low
246High6/28/2021High
256Low7/6/2021Low
26
27
Sheet1
Cell Formulas
RangeFormula
E2:E7E2=SUMPRODUCT(($B$2:$B$25="High")*($A$2:$A$25=D2))
L2:L7L2=SUMPRODUCT(($I$2:$I$25="High")*(--MONTH($H$2:$H$25)=K2))
A3:A25A3=IF(MOD(ROW(),4)=2,A2+1,A2)
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Unless you have a very old version of Excel, COUNTIFS provides an efficient formula for your counts.
For example

21 10 03.xlsm
ABCDEF
1MonthStockMonthHighLow
21Low113
31High231
41Low313
51Low422
62High522
72High613
82Low
92High
103Low
113Low
123High
133Low
144Low
154High
164Low
174High
185High
195Low
205Low
215High
226Low
236Low
246High
256Low
Count High
Cell Formulas
RangeFormula
E2:F7E2=COUNTIFS($A$2:$A$25,$D2,$B$2:$B$25,E$1)
 
Upvote 0
Solution
Welcome to MrExcel Message Board:
Book1
ABCDEFGHIJKLM
1MonthStockMonthCountMonthStockMonthCount
21Low111/3/2021Low11
31High231/11/2021High23
41Low311/19/2021Low31
51Low421/27/2021Low41
62High522/4/2021High52
72High612/12/2021High62
82Low2/20/2021Low
92High2/28/2021High
103Low3/8/2021Low
113Low3/16/2021Low
123High3/24/2021High
133Low4/1/2021Low
144Low4/9/2021Low
154High4/17/2021High
164Low4/25/2021Low
174High5/3/2021High
185High5/11/2021High
195Low5/19/2021Low
205Low5/27/2021Low
215High6/4/2021High
226Low6/12/2021Low
236Low6/20/2021Low
246High6/28/2021High
256Low7/6/2021Low
26
27
Sheet1
Cell Formulas
RangeFormula
E2:E7E2=SUMPRODUCT(($B$2:$B$25="High")*($A$2:$A$25=D2))
L2:L7L2=SUMPRODUCT(($I$2:$I$25="High")*(--MONTH($H$2:$H$25)=K2))
A3:A25A3=IF(MOD(ROW(),4)=2,A2+1,A2)
Hi, Thanks a lot for your advise. It works!
 
Upvote 0
Hi, Thanks a lot for your advise. It works!
And also thanks for reminding to set my excel version info. Will do.

Cheers!
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Unless you have a very old version of Excel, COUNTIFS provides an efficient formula for your counts.
For example

21 10 03.xlsm
ABCDEF
1MonthStockMonthHighLow
21Low113
31High231
41Low313
51Low422
62High522
72High613
82Low
92High
103Low
113Low
123High
133Low
144Low
154High
164Low
174High
185High
195Low
205Low
215High
226Low
236Low
246High
256Low
Count High
Cell Formulas
RangeFormula
E2:F7E2=COUNTIFS($A$2:$A$25,$D2,$B$2:$B$25,E$1)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top