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: 7

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
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)
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,259
Office Version
  1. 365
Platform
  1. Windows
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)
 
Solution

dhana_ram

New Member
Joined
Oct 2, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
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!
 

dhana_ram

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

ADVERTISEMENT

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)
 

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
You're Welcome & Thanks for follow-up.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
54,259
Office Version
  1. 365
Platform
  1. Windows
Hi, Thanks a lot for your advise. It works!
And also thanks for reminding to set my excel version info. Will do.
You're welcome. And thanks for updating your profile. (y)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,466
Messages
5,831,792
Members
430,087
Latest member
meagerd

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
Top