cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

SELECTING PATTERN OF NUMBERS

ppal
17-Peridot

SELECTING PATTERN OF NUMBERS

Lets say I had a column of numbers (5 digits)

71053

71187

12378

72678

My required function was

f(7,1,’x’,”x”,”x”) =710537 and 71187

f(“x”,2,”x”,”x”,”x”)=12378 and 72678

f(“x”,x,”x”,”x”,”8”)=12378 and 72678

f(“x”,x,”6”,”x”,”8”)= 72678

etc

 

What would be the best approach ?

ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:ppal)

Step 1 Separate data for each digit.

ttokoro_0-1647914032679.pngimage.png

Step 2 Check the condition.

image.pngimage.png

View solution in original post

2 REPLIES 2
ttokoro
20-Turquoise
(To:ppal)

Step 1 Separate data for each digit.

ttokoro_0-1647914032679.pngimage.png

Step 2 Check the condition.

image.pngimage.png

Werner_E
25-Diamond I
(To:ppal)

Here is different approach.

The filter mask is provided as one single string, so there is no limit on number of digits in the data numbers or size of filter mask. To keep it all self-contained I found it better to provide the data vector as a second argument to the function.

The function assumes leading zeros for the numbers and treats any non-numeric character in the mask string as a wildcard (meaning "any digit").

Werner_E_0-1647964733923.png

P6 worksheet attached

 

Announcements

Top Tags