Listing numbers conditionally

Usercode

Board Regular
Joined
Aug 18, 2017
Messages
107
Office Version
  1. 2016
Platform
  1. Windows
I need a formula to separate and list desired numbers in a certain range from the data i have.

For example, if my data is 4,7,15,19,35,41,8,51,56,64,65,71,75,76,42,38 in A2:P2, then if I want to separate and list the numbers between 50 and 59, the desired outcome should be 51,56 in U2:V2. I attached an example file. It would be good to have the numbers in ascending order. Thanks in advance.

Example file: https://1drv.ms/x/s!AoGkZUHlKui9gR44xEi-kQBlTFs1
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hello.
See if the attachment can help you

HTML:
https://drive.google.com/file/d/1K8DGRnkFWRBjplEADbAq3xZ_XiGr-3FZ/view?usp=sharing
 
Upvote 0
Thanks for your solution, gfranco. I have a small problem. in this example the data row has 16 cells (A:P) , when there are less cells or more, the formula doesn't give any outcome. What should i do about this?
 
Upvote 0
This works if you can use AGGREGATE

=IFERROR(INDEX($A2:$P$2,1,AGGREGATE(15,6,COLUMN($A2:P2)/(($A2:$P2>=50)*($A2:$P2<=59)),COLUMN(A2))),"")
Array formula, use Ctrl-Shift-Enter
copy across the columns from U2 onwards
 
Last edited:
Upvote 0
I tried your formula, but it didn't give any outcomes. it displays blank cells. I did Ctrl-Shift-Enter. In your case, does it work when there are less data like A to K?
 
Upvote 0
Try this. Enter into cell U2, confirm with Ctrl + Shift + Enter, then copy across and down:

=IFERROR(SMALL(IF($A$2:$P$2<(ROWS($A$2:A2)*10)*($A$2:$P$2>(ROWS($A$2:A2)-1)*10),$A$2:$P$2),COLUMNS($U2:U2)),"")
 
Upvote 0
I tried your formula, but it didn't give any outcomes. it displays blank cells. I did Ctrl-Shift-Enter. In your case, does it work when there are less data like A to K?

My formula works perfectly when entered with Ctrl-Shift-Enter on your example file.
 
Upvote 0
Thanks Istvan. With this formula I got the results for numbers from 1-9. How can I specify the number range in this formula? If i want to numbers from 50 to 59, what should I change here?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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