Search a range of numbers for group of numbers?

Hi

Trying to do this in Numbers.

Keeping this really simple for example purposes

I have a range of numbers, lets say 1 to a million (random numbers) on a spreadsheet

I have a group of numbers lets say 200 to 250 (that are consecutive)

I want to be able to search the range 1 to 1 million) with my group (200 to 250), and show if any of my range are in the group.


It's easy to use Find to find a number in a range, but cant seem to do a group of numbers at once.


Thanks Numbers Boffins.



Posted on Dec 30, 2023 3:13 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 30, 2023 1:06 PM

It sounds like you have a long list of numbers and you are trying to mark which ones are also found on a shorter list of numbers. There are numerous ways to do this. Here are a few.



The List table is a column of all the numbers you are interested in. 200 through 250.


Formula in Table 1::B2 =COUNTIF(List::A,A)>0

Fill down to complete the column

Those that are found will be TRUE. Those that are not will be FALSE.


Another formula would be

=IFERROR(MATCH(A,List::A,0)>0,"")

This will be TRUE for matches and blank for non-matches.


For your particular problem of all numbers from 200 to 250 you could do away with the second table and use the formula

=AND(A>=200,A<=250)

This would be much much faster if Table 1 has a whole lot of rows.

So, if your problem is as you stated (often this is not the case), this would be the recommended method


You can filter or sort the table by column B to gather up all the matching rows



3 replies
Question marked as Top-ranking reply

Dec 30, 2023 1:06 PM in response to MrEco

It sounds like you have a long list of numbers and you are trying to mark which ones are also found on a shorter list of numbers. There are numerous ways to do this. Here are a few.



The List table is a column of all the numbers you are interested in. 200 through 250.


Formula in Table 1::B2 =COUNTIF(List::A,A)>0

Fill down to complete the column

Those that are found will be TRUE. Those that are not will be FALSE.


Another formula would be

=IFERROR(MATCH(A,List::A,0)>0,"")

This will be TRUE for matches and blank for non-matches.


For your particular problem of all numbers from 200 to 250 you could do away with the second table and use the formula

=AND(A>=200,A<=250)

This would be much much faster if Table 1 has a whole lot of rows.

So, if your problem is as you stated (often this is not the case), this would be the recommended method


You can filter or sort the table by column B to gather up all the matching rows



Dec 30, 2023 6:30 AM in response to MrEco

It’s not clear if your second range is a unique list with one number in each cell.

if it is, you can use any lookup function to determine IF it is found. Or COUNTIF to determine if it shows up in the list how many times


if you want to know what row it shows up on, you can use the MATCH function, which will return the item number in the list.

remember that a lookup function will return the first item if finds, if you want to know if it shows up multiple times, then you need to do a COUNTIF.


jason

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Search a range of numbers for group of numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.