Count Numbers in Contiguous Number Range

Adeneen

New Member
Joined
Mar 10, 2020
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

New to the forum and really appreciate anyone who can assist. Below is a simple version of a much more complex data set that I am working on. I am trying to get excel to identify numbers within a contiguous number range in a single cell and place an "X" in the corresponding column. It will find the beginning and end of the number range, but not the numbers in between. I can't get it to work. Any suggestions?

1583855234379.png


Current formulas:
"ID" Column: =RIGHT(B2,LEN(B2)-FIND("SS",B2)+1)
"101" Column, copied across thru 120: =IF(NOT(ISERROR(FIND(D$1,$C2))),"X","")

Much appreciated,

Andrew
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to the MrExcel forum!

Try this:

Book1 (version 1).xlsb
ABCDEFGHIJKLMNOPQRSTUVW
1NumberID101102103104105106107108109110111112113114115116117118119120
2Part AD_SS-101SS-101X                   
3Part AD_SS-102-106SS-102-106 XXXXX              
Sheet7
Cell Formulas
RangeFormula
C2:C3C2=MID(B2,FIND("_",B2)+1,99)
D2:W3D2=IF(AND(D$1>=MID($C2,4,3)+0,D$1<=RIGHT($C2,3)+0),"X","")


This formula makes several assumptions, that each part starts with SS-, and that the numbers are always 3 digits. If that's not the case, let us know, and we can find an alternative.
 
Upvote 0
This formula makes several assumptions, that each part starts with SS-, and that the numbers are always 3 digits. If that's not the case, let us know, and we can find an alternative.
I'll give it a try!

There are a few instances where the part number starts with a SSN- or SSGN-, but three digits is consistent.
 
Upvote 0
Upvote 0
awesome. I think I can see what you're doing now. If I have 2 digit identifiers (like "23" instead of "101") is there a lot of changes to the formula?
 
Upvote 0
This version should handle 2 or 3 digit identifiers:

Book1 (version 1).xlsb
ABCDEFGHIJKLMN
1NumberID979899100101102103104105106107
2Part AD_SS-101SS-101    X      
3Part AD_SS-102-106SS-102-106     XXXXX 
4Part AD_SSGN-98-102SSGN-98-102 XXXXX     
5Part AD_SSX-99SSX-99  X        
Sheet7
Cell Formulas
RangeFormula
C2:C5C2=MID(B2,FIND("_",B2)+1,99)
D2:N5D2=IF(AND(D$1>=SUBSTITUTE(MID($C2,FIND("-",$C2)+1,3),"-","")+0,D$1<=ABS(RIGHT($C2,3)+0)),"X","")


I can create a version that handles any length, but it would be pretty long.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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