Countif value is not blank and less than 70% of adjacent cell"s value

jfin1ty

New Member
Joined
May 15, 2023
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi all,
Hoping someone can help me with this. I'm guessing it super simple, but I can't find a solution anywhere online.
Basically, what I'm trying to do is count the number of times each cell in a range (G4:G9) is not blank and is less than 70% of the value of the cell that is 2 columns adjacent from is in range E4:E10.
I'd likely put the formula in cell A1. I know I could easily use a helper column like I have on the attached sheet and just count the true or false values but space on the table where I plan on actually using the formula is very limited.

Book1
ABCDEFGH
1
2
3
44430True
54440False
64027True
72524False
8125True
91211False
Sheet1
Cell Formulas
RangeFormula
H4:H9H4=IF(G4<E4-E4/100*30,"True","False")


Thanks in advance,
Jfinity.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
does this work
=SUMPRODUCT(--(G4:G9<(E4:E9*0.7))*(G4:G9<>""))

Book16
ABCDEFGHI
13
2
3
44430TrueTRUE
54440FalseFALSE
64027TrueTRUE
725TrueTRUE
8125TrueTRUE
91211FalseFALSE
Sheet1
Cell Formulas
RangeFormula
A1A1=SUMPRODUCT(--(G4:G9<(E4:E9*0.7))*(G4:G9<>""))
H4:H9H4=IF(G4<E4-E4/100*30,"True","False")
I4:I9I4=G4<(E4*0.7)
 
Upvote 0
does this work
=SUMPRODUCT(--(G4:G9<(E4:E9*0.7))*(G4:G9<>""))

Book16
ABCDEFGHI
13
2
3
44430TrueTRUE
54440FalseFALSE
64027TrueTRUE
725TrueTRUE
8125TrueTRUE
91211FalseFALSE
Sheet1
Cell Formulas
RangeFormula
A1A1=SUMPRODUCT(--(G4:G9<(E4:E9*0.7))*(G4:G9<>""))
H4:H9H4=IF(G4<E4-E4/100*30,"True","False")
I4:I9I4=G4<(E4*0.7)
Hi etaf,
If I use your formula on its own in a separate sheet it works perfectly however when I put it in the workbook I'm making I get the "#VALUE" error.
Is your formula affected by the fact my actual data in G4:G9 and E4:E9 isn't numerical values but rather formulas evaluating to numbers?

For example, on the actual sheet that I'm going to use the code for, the "number" in E4 is the result of a vlookup based on data entered in C4 that looks up a table on another sheet within the workbook and looks like this =IFERROR(VALUE(VLOOKUP(C4,Trucks[#All],3,FALSE)+F4),"")
And the "number" in G4 is the result of a very complicated IF/SUMIF formula that looks like this
=IFERROR(IF(OR(H4<>"",D4<>""),IF(AND(O4<>"",OR(OFFSET(O4,-1,0)="",OFFSET(O4,-1,0)="T")),SUM(O4:INDEX(O4:$O$100,MATCH(TRUE,($O4:O$100=""),0)))-SUMIFS(O4:O$100,AC4:AC$100,"NO",L4:L$100,"<>RTW",L4:L$100,"<>RTB")-SUM(SUMIF(L4:L$100,{"RTW","RTB"},O4:O$100))),""),"")
 
Upvote 0
Give this one a try.

23 05 22.xlsm
AEG
13
2
3
44430
54440
64027
72524
8125
91211
Count (2)
Cell Formulas
RangeFormula
A1A1=COUNT(FILTER(G4:G9,IFERROR(G4:G9-0.7*E4:E9<0,0),""))
 
Upvote 0
Solution
Give this one a try.

23 05 22.xlsm
AEG
13
2
3
44430
54440
64027
72524
8125
91211
Count (2)
Cell Formulas
RangeFormula
A1A1=COUNT(FILTER(G4:G9,IFERROR(G4:G9-0.7*E4:E9<0,0),""))
Legend! That's done the trick. Thanks so much.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
Hi Peter,
If I wanted to add a few more criterion to this formula how would I do it?
I'd like to add criteria for it to only count where values in the range L4:L9 = "WP" and where values in the range AG4:AG9 are blank.
I've not used the filter formula before so im struggling to work out how to add to it.
 
Upvote 0
Hi Peter,
If I wanted to add a few more criterion to this formula how would I do it?
I'd like to add criteria for it to only count where values in the range L4:L9 = "WP" and where values in the range AG4:AG9 are blank.
I've not used the filter formula before so im struggling to work out how to add to it.
All good Peter. I worked it out in the end. It was a matter of adding in some more brackets and "*"
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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