Create a countifs formula after a vlookup output

Mattymoo

New Member
Joined
Jan 3, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have created a vlookup formula that will return a value if true and a text value if false.
I then need to do a count of the number of text results however the countifs formula still reads the vlookup output as a formula.
I have tried to break down the output and using sumproduct but i keep hitting a brick wall.
Can anybody shed any light on what im missing.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
What formula do you have?

It should look like =COUNTIFS(Range,VLOOKUP(Lookup,Range,column index,Matchtype),............)
 
Upvote 0
I am doing =countifs(criteria_range1,Criteria1,Criteria_range2,Criteria2).
Both ranges are looking up a vlookup formula. I have copied and pasted the output of the formula and can get it to work but going forward that would be a bit impractical.

thank you for replying.
 
Upvote 0
Sorry, a bit confused. Just re read your initial post. VLOOKUP returns a value from a range when given a value to lookup in the first column of that range. It cant return a range of values. You have said that it return a value if true and a text value if false? This sounds like an IF Statement. Are you able to post a snippet of data?

I have enclosed below a simple Countif with a VLOOKUP for the Criteria
Book1
CDEFGHI
2RangeCountValue
3Apple3GreenGreenApple
4BananaYellowBanana
5CherryRedCherry
6DamsonPurpleDamson
7Apple
8Banana
9Cherry
10Damson
11Apple
12Banana
13Cherry
14Damson
Sheet1
Cell Formulas
RangeFormula
E3E3=COUNTIF(C3:C14,VLOOKUP(G3,H3:I6,2,0))
 
Upvote 0
Its me not explaining thigs correctly.
I have two sheets of data and i am using the below to find out if E2 is on the Budget by Month'!$B$6:$B$250 range. If so it delivers the data and if not it delivers the NOT IN HCSS message.
=IFNA(VLOOKUP(E2,'Budget by Month'!$B$6:$B$250,1,),"NOT IN HCSS")

The above works fine but them on a seperate sheet i want to flag the number of NOT IN HCSS which essentially is an #NA. I need to do it using 2 criterias i.e. how many #NAs in a certain preiod.

=COUNTIFS('Actuals by month'!$C$2:$C$5000,Apr!F3,'Actuals by month'!$Q$2:$Q$5000,Apr!H2) The trouble i have from here is the APR!h2 is the output form the lookup formula above.
 
Upvote 0
Its me not explaining thigs correctly.
I have two sheets of data and i am using the below to find out if E2 is on the Budget by Month'!$B$6:$B$250 range. If so it delivers the data and if not it delivers the NOT IN HCSS message.
=IFNA(VLOOKUP(E2,'Budget by Month'!$B$6:$B$250,1,),"NOT IN HCSS")

The above works fine but them on a seperate sheet i want to flag the number of NOT IN HCSS which essentially is an #NA. I need to do it using 2 criterias i.e. how many #NAs in a certain preiod.

=COUNTIFS('Actuals by month'!$C$2:$C$5000,Apr!F3,'Actuals by month'!$Q$2:$Q$5000,Apr!H2) The trouble i have from here is the APR!h2 is the output form the lookup formula above.
and thats where i can't get the count formula talking to the ifna lookup formula.
 
Upvote 0
So, on the "Apr" sheet, in H2, you have =IFNA(VLOOKUP(E2,'Budget by Month'!$B$6:$B$250,1,),"NOT IN HCSS"), which will return either a value or "NOT IN HCSS". Then on the "Actuals by month" sheet, you have =COUNTIFS('Actuals by month'!$C$2:$C$5000,Apr!F3,'Actuals by month'!$Q$2:$Q$5000,Apr!H2), where it counts the number of "NOT IN HCSS".

I take it that in Column C is a range of Months, ie January, February, etc, and in Apr!F3 is a given Month? If Column C is Dates, ie, 01/01/2022, then you will have to have to set the upper and lower dates for the month. For example if you want to count the number of "NOT IN HCSS" in April, you will have to use something like

=COUNTIFS('Actuals by month'!$C$2:$C$5000,">="&"01/04/2022",'Actuals by month'!$C$2:$C$5000,"<="&"30/04/2022",'Actuals by month'!$Q$2:$Q$5000,Apr!H2)

Hope I am on the right path
 
Upvote 0
Solution
Hi, Im really sorry I am obviously having a no brain day. I now have the formula working. I have swapped the =COUNTIFS('Actuals by month'!$C$2:$C$5000,Apr!F3,'Actuals by month'!$Q$2:$Q$5000,Apr!H2) to =COUNTIFS('Actuals by month'!$Q$2:$Q$5000,Apr!H2,'Actuals by month'!$C$2:$C$5000,Apr!F3). I really don't why that would be. Yes you formula above would work also.
Thank you for working this through with me.
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

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