index match or hlookup? between two dates multiple countifs

Piers

New Member
Joined
Aug 24, 2022
Messages
9
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
Platform
  1. Windows
Morning all,

I have three criteria for my countifs formula 1. Must match "U", 2. count only the values "U" above or equal to the date in Main!F5 3. count only the values "U" below or equal to the date in Main!G5

ive been trying to work with index and match but I cannot for the life of me get it to work in any other format.

current formula is but either yields a 1 or N/a value - as in a true statement and not sure how to work it

=COUNTIFS(INDEX($K$5:$AAA$1000,,MATCH($I$7,INDEX($K8:$AAA8,1,),0)),">="&Main!$F5,INDEX($K$5:$AAA$1000,,MATCH($I$7,INDEX($K8:$AAA8,1,),0)),"<="&Main!$G5)

any help will be appreciated
 

Attachments

  • Picture2.png
    Picture2.png
    81.2 KB · Views: 9

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Further information - i would like to be able to drag this down to count per row - the date variable of november is to stay the same but the row count by row is important - names have been hidden so this is per patient
 
Upvote 0
That image is useless as it is unreadable, can you post some sample data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
im not allowed to download any add ons or programmes onto this computer as is a work security thing.

the best i can do is post redacted screenshots


sorry for being no help
 

Attachments

  • Picture3.png
    Picture3.png
    17.4 KB · Views: 9
Upvote 0
im not allowed to download any add ons or programmes onto this computer as is a work security thing.

the best i can do is post redacted screenshots


sorry for being no help
 

Attachments

  • Picture3.png
    Picture3.png
    88.4 KB · Views: 8
Upvote 0
Unfortunately that image is still useless as it doesn't show the row numbers or the cells that you are referencing in the formula.
Can you please explain in words what you are trying to do?
 
Upvote 0
In cell I8 i would like to input a formula to count the number of "U" values in the row starting at K8 continuously across that row as long as they are within the dates k5 (01/11/21) increaasing daily L5 (02/11/21), m5 (03/11/21) and so on.

My criteria would be that i only want the "U" values which are within the dates on my main sheet in F5 (admission date) and G5 (discharge date) any "U" values outside of these dates are not to be counted

i wanted to used the date values in K5 onwards as my reference point for the formula, it works as an individual cell thing like this =IF(AND(K8="U",K5<=Main!$G6,K5>=Main!$F6),COUNTIF(K8,"U"),0) however i would like that to go across the whole row. thats where i went to find the values which match my date criteria and then find the "U" values with the index formula

=COUNTIFS(INDEX($K$5:$AAA$1000,,MATCH("U",INDEX($K8:$AAA8,1,),0)),">="&Main!$F5,INDEX($K$5:$AAA$1000,,MATCH("U",INDEX($K8:$AAA8,1,),0)),"<="&Main!$G5)

i dont know if i went down the right route or made things more complicatd than needed

thankyou for being so understanding
 
Upvote 0
Ok, how about
Excel Formula:
=COUNTIFS($K$5:$AAA$5,">="&Main!F5,$K$5:$AAA$5,"<="&Main!G5,K8:AAA8,"U")
 
Upvote 0
Ok, how about
Excel Formula:
=COUNTIFS($K$5:$AAA$5,">="&Main!F5,$K$5:$AAA$5,"<="&Main!G5,K8:AAA8,"U")
much easier than what i was doing - thankyou - definitely over complicated things
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,215
Members
453,024
Latest member
Wingit77

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