Combine vlookup with countifs formula

asmith601

New Member
Joined
Dec 5, 2017
Messages
20
Office Version
  1. 2019
Platform
  1. Windows
Hi everyone. I need some help combining a formula. The formula I have below works for me, but there is 1 part that is manually entered which is highlight in red below

=COUNTIFS('Roster Engagement'!D1:FM1,">="&C11,'Roster Engagement'!D1:FM1,"<="&D11,'Roster Engagement'!D15:FM15,'Roster Engagement'!B57)

The D15:FM15 is the row reference which is currently manually done. It is tied to a name so different name, different row number. The formula below automatically retrieves the proper row number when the same is selected:

=VLOOKUP(B2,'Roster Engagement'!A1:IO50,249,FALSE)

I am decent at excel, but simply cannot get the 2 statements combined to fully automate My thought are:

=COUNTIFS('Roster Engagement'!D1:FM1,">="&C11,'Roster Engagement'!D1:FM1,"<="&D11, VLOOKUP(B2,'Roster Engagement'!A1:IO50,249,FALSE) ,'Roster Engagement'!B57)

Any ideas? Thanks in advance!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Welcome to Mr Excel

Are you saying that
=VLOOKUP(B2,'Roster Engagement'!A1:IO50,249,FALSE)
returns 15 (the row used in the part in red)?

If so, maybe you can replace
'Roster Engagement'!D15:FM15
by
INDEX('Roster Engagement'!D:FM,VLOOKUP(B2,'Roster Engagement'!A1:IO50,249,FALSE),0)

Hope this helps

M.
 
Upvote 0
I don't think OP meant that the vlookup literally returns the row number 15.
I think it means the vlookup returns a value from the appropriate row # based on finding the match to B2 in column A..

In that case, try
=COUNTIFS('Roster Engagement'!D1:FM1,">="&C11,'Roster Engagement'!D1:FM1,"<="&D11,INDEX('Roster Engagement'!D1:FM50,MATCH(B2,'Roster Engagement'!A1:A50,0),0),'Roster Engagement'!B57)
 
Last edited:
Upvote 0
I don't think OP meant that the vlookup literally returns the row number 15.
I think it means the vlookup returns a value from the appropriate row # based on finding the match to B2 in column A..

In that case, try
=COUNTIFS('Roster Engagement'!D1:FM1,">="&C11,'Roster Engagement'!D1:FM1,"<="&D11,INDEX('Roster Engagement'!D1:FM50,MATCH(B2,'Roster Engagement'!A1:A50,0),0),'Roster Engagement'!B57)

Yes, i also considered this possibility. But I was not sure if that was the case. That's why I asked.

M.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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