Need a formula to return 1.

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,446
Office Version
  1. 2007
Platform
  1. Windows
I need a formula to return 1 if the number is between 1 and 7.
Or
What formula should be used to count cells that have numbers in it ?

both would be nice.

Thank you.
Serge.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I need a formula to return 1 if the number is between 1 and 7.
Or
What formula should be used to count cells that have numbers in it ?

both would be nice.

Thank you.
Serge.

Also...

=AND(A2 >=1, A2 <= 7) + 0

By the way:

=COUNT(A2:A10)

counts any number from A2:A10.

=COUNTIF(A2:A10,1)

counts just the occurrences of 1.

=COUNTIF(A2:A10,">=1)-COUNTIF(A2:A10,">7")

counts all numbers between 1 and 7 from A2:A10.

The following is equivalent to the latter:

=SUMPRODUCT(--(A2:A10>=1),--(A2:A10<=7))
 
Upvote 0
Thank you to both of you for your various formulas, now I have plenty.
Serge.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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