Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
Column A        Column B
5                         10
150                       200

The difference between Column A and Column B will tell you how many integers there are between the limits. Is there a formula to extract all these integers?

For example

  • Row 1 the numbers that lie within the range are: 6, 7, 8, 9.
  • Row 2 the numbers that lie within the range are: 151, 152, 153, 154, 155 ... 199.
share|improve this question

1 Answer 1

In C1 and copied down as far as necessary and across on a row by row basis until no more numbers are visible:

=IF($A1+COLUMN()-2<$B1,$A1+COLUMN()-2,"")  

Uses COLUMN to increment because the order start/finish complicates matters relative to stop/start (ie easier to deal with 10/5 and 200/150 than the other way around).

This reads "if the result of the calculation is less than the limit, display it, otherwise show [blank]. With 'the calculation' being add two less than the current column number (therefore 1) to start."

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.