Countifs and ABS

nikolaki

New Member
Joined
Oct 14, 2023
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I want to count the cells in column 'F' where the value is >='I2' AND the Absolute value of 'E:E' > 'I7', but some of the cells in 'E:E' contain text.

Excel doesn't like this:
=COUNTIFS(F:F,">="&I2,ABS(E:E),">="&I7).


Any help is deeply appreciated. Thanks much in advance.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
The odd numbered arguments to COUNTIFS are ranges... ABS(E:E) is not a range.
 
Upvote 0
Try something like this. It is best not to reference whole columns in your formula.
Book1
EFGH
2447
355
4Text1
5-12
6-80
7-146
Sheet2
Cell Formulas
RangeFormula
H2H2=SUM(--(FILTER(ABS(E2:E7),ABS(ISNUMBER(E2:E7)))>=I7),--(F2:F7>=I2))
 
Upvote 0
Alex, I think your formula needs to be changed to:
SUM(--( IFERROR( (ABS(E2:E7)>=I7),0)), --(F2:F7>=I2) )

Book1
EFGHI
1
24474
355
4Text17
5-12
6-803
7-1462
Sheet1
Cell Formulas
RangeFormula
H2H2=SUM(--(FILTER(ABS(E2:E7),ABS(ISNUMBER(E2:E7)))>=I7),--(F2:F7>=I2))
H4H4=SUM(--( IFERROR( (ABS(E2:E7)>=I7),0)), --(F2:F7>=I2) )
H6H6=SUM(IFERROR( (ABS(E2:E7)>=I7),0)*(F2:F7>=I2) )
 
Upvote 0
@nikolaki - In your text you have > 'I7' while in your CountIfs you have >= I7 (includes the equal sign), which is correct, you may need to amend all solutions accordingly.
My and Scott's interpretation is that you want to count the cells in Column F that meet both criteria, @AhoyNC interpretation was to add cells in both columns E & F based on independently assessing the criteria in each. Perhaps you can clarify.

Thanks @AhoyNC for your feedback, while my interpretation is different it did make me revisit it and my comparision signs didn't match either the text of the countifs version.
To match the Countifs version both should be >=
Excel Formula:
=SUM( IFERROR( ABS(E2:E7)>=I7,0) * (F2:F7>=I2) )

@Scott Huish
I opted to put the IFERROR around the whole expression so that the Text #VALUE error made the whole expression return a multiplier of 0.
In your formula, it sets text to -1 which means that if you enter a figure of -1 or less in I7 it will get evaluate as True.
PS: Is there any advantage to using the comma in sumproduct ? If you use multiply instead of the comma you don't need either of the double Unaries "--".
 
Upvote 0
Try this:

=COUNTIFS(F:F,">="&I2,E:E,">="&I7) + COUNTIFS(F:F,">="&I2,E:E,"<="&-I7)
 
Upvote 0
@nikolaki - In your text you have > 'I7' while in your CountIfs you have >= I7 (includes the equal sign), which is correct, you may need to amend all solutions accordingly.
My and Scott's interpretation is that you want to count the cells in Column F that meet both criteria, @AhoyNC interpretation was to add cells in both columns E & F based on independently assessing the criteria in each. Perhaps you can clarify.

Thanks @AhoyNC for your feedback, while my interpretation is different it did make me revisit it and my comparision signs didn't match either the text of the countifs version.
To match the Countifs version both should be >=
Excel Formula:
=SUM( IFERROR( ABS(E2:E7)>=I7,0) * (F2:F7>=I2) )

@Scott Huish
I opted to put the IFERROR around the whole expression so that the Text #VALUE error made the whole expression return a multiplier of 0.
In your formula, it sets text to -1 which means that if you enter a figure of -1 or less in I7 it will get evaluate as True.
PS: Is there any advantage to using the comma in sumproduct ? If you use multiply instead of the comma you don't need either of the double Unaries "--".
Long standing opinion on this board is that the -- is faster.
I don't think it should matter if it returns -1 because it would never match an absolute value being greater than I7 because I7 would have to be a positive value for this question to make sense.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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