COUNTIF using HLOOKUP as start range and 'last blank cell in row' as end range (maybe)?? Help Please

77highland

New Member
Joined
Nov 11, 2013
Messages
7
Hi All,

Need help with 2 formulas, kind of related as both need a HLOOKUP start range and 'last blank cell in row' as end range (i believe), any help will be greatly appreciated.......


In column M (M2:M5) i need a formula along the lines of......

=IF(L2="Low",COUNTIF(HLOOKUP(K2,A1:J5,2):'last blank cell in row',"<600"),IF(L2="Low",COUNTIF(HLOOKUP(K2,A1:J5,2):'last blank cell in row',">600"),IF(L2="","No")))

In column O (O2:O5) i need a formula along the lines of......

=AVERAGE(HLOOKUP(N2,A1:J5,2):'last blank cell in row')

But please note that the date range continuously expands via inserting columns (between columns J and K in the example below).


ABCDEFGHIJKLMNO
101/05/1802/05/1803/05/1804/05/1805/05/1806/05/1807/05/1808/05/1809/05/1810/05/18Priority Tracking Start DatePriorityPriority % Hit RateOH Completion DateAverage Mileage since OH
230040050050070020040050001/05/1802/05/18
3400200800900500600100040002/05/18High01/05/18
4200300700800700500100004/05/18Low03/05/18
540080010002000030040004/05/18High02/05/18

<tbody>
</tbody>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Excel will automatically adjust the ranges in formulas as rows/columns are added. So the best recommendation is to add a new empty column now, which will be K, shifting K:O over one. Then you can have this layout:



ABCDEFGHIJKLMNOP
11/5/20182/5/20183/5/20184/5/20185/5/20186/5/20187/5/20188/5/20189/5/201810/5/2018Priority Tracking Start DatePriorityPriority % Hit RateOH Completion DateAverage Mileage since OH
2300400500500700200400500No2/5/2018457.1428571
340020080090050060010004002/5/2018High41/5/2018600
420030070080070050010004/5/2018Low33/5/2018466.6666667
54008001000200003004004/5/2018High02/5/2018385.7142857
6No#DIV/0!

<tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
N2=IF(M2="","No",COUNTIFS(A$1:K$1,">="&L2,A2:K2,IF(M2="Low","<600",">=600")))
P2=AVERAGEIF(A$1:K$1,">="&O2,A2:K2)

<tbody>
</tbody>

<tbody>
</tbody>


When you add a new column, add it between J:K, and all the formulas will automatically adjust.
 
Last edited:
Upvote 0
Hi Eric W,

Thank you very much for the reply.....

Your suggestion kind of works, but I am having some issues.......

Using your formulae and health checking a small amount of sample data some of the values returned are +1, and then if I removed the "=" from ">=" then some of the values returned are "-1".

I have been racking my brains for hours and cannot figure out whats going on
 
Upvote 0
Can you show an example of the problem, with the formulas? I can't picture how either one of those formulas could return a -1.
 
Upvote 0
I apologise, scrap my last............

Someone had added a date out of sync which threw everything off. Now works like a charm.

Thank you very much Eric W

SOLVED
 
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

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