COUNTIF/s with plus or minus a certain value

Nathag

New Member
Joined
Aug 1, 2013
Messages
17
Is there a way to use Countif/s to count a row if the value in a field is plus or minus the value in the criteria range?

For example, I might write =COUNTIF('Sheet1'!$A$2:$A$546,'Sheet2'!H2"-80"), and I would get an error informing me that there is a problem with my formula. I also tried adding the & symbol so that I have =COUNTIF('Sheet1'!$A$2:$A$546,'Sheet2'!H2& "-80") and I get the same error result.

I know that I can use the '<', '>', '<=', '>=', or '<>' operators with countif, but what about getting an exact result if it is plus or minus the number in another cell? I just want to return a 1 or 0 if it meets my criteria, which is why I am trying countif.

Is there a better way to do this than Countif?
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this:

Code:
[COLOR=#333333]=COUNTIF(Sheet1!$A$2:$A$546,">="&Sheet2!H2-80)[/COLOR]

For + or - that range:

Code:
[COLOR=#333333]=COUNTIFS(Sheet1!$A$2:$A$546,">="&Sheet2!H2-80,[/COLOR][COLOR=#333333]Sheet1!$A$2:$A$546,"<="&Sheet2!H2+80[/COLOR][COLOR=#333333])[/COLOR]
 
Last edited:
Upvote 0
I appreciate the help, unfortunately neither approach worked.

I get the There's an error in the formula you entered error.
 
Upvote 0
I tried it again here, using the exact ranges ... and it works fine. No errors.

Did you copy and paste exactly?

Code:
=COUNTIF(Sheet1!$A$3:$A$547,">="&Sheet2!H2-80)
 
Upvote 0
Thank you, Erik. I got the formula to work without error. Now it is just a matter of modifying it as a multi-criteria countifs statement so that it returns only what I want. I think this problem is solved.
 
Upvote 0
@Nathag, glad you are closer to goal.

If you have time, and for the sake of future readers, it would be helpful if you could explain what wasn't working about the suggestions as given or what you found to be the "error in translation."
 
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