Masking Numbers

Ben51

New Member
Joined
Feb 29, 2016
Messages
14
I have a set of numbers in column B[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.01.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.03.01.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.04.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.02.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42494, width: 112"]07.02.04.04[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

I would like a fill formula to fill column A and reduce the numbers in column B to '07.01.01.01' in length unless the number is already that length or smaller. in which case i would like the fill formula to knock off the last bit

So column A would look like this






[TABLE="width: 500"]
<tbody>[TR]
[TD]07.01.01.01[/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.01.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]07.01.01.03[/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.03.01.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.04[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.01.01.04.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.02[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42493, width: 112"]07.02.01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42494, width: 112"]07.02.04[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 112"]
<tbody>[TR]
[TD="class: xl42494, width: 112"]07.02.04.04
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Thanks in Advance Guys!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
What does this bit mean 'to '07.01.01.01' in length unless the number is already that length or smaller'?? It seems you have just trimmed off the last 3 characters to me.
 
Upvote 0
For the first 3 examples you could just use =LEFT($B1,11) and fill down.

Why does 07.02.01 become 07.02? And why does 07.02.04.04 become 07.02.04?
There has to be some additional criteria for this in addition to what you have specified?
 
Upvote 0
The length the first 3 numbers have been trimmed to is my desired length for column A, However, if the number in column B is the same length or smaller than my desired length then i must mask the last 2 digits.
 
Last edited:
Upvote 0
Hi, here is one possible option if I've understood correctly:


Excel 2013
AB
107.01.01.0107.01.01.01.01
207.01.01.0307.01.01.03.01.01
307.01.01.0407.01.01.04.01
407.0207.02.01
507.02.0407.02.04.04
Sheet1
Cell Formulas
RangeFormula
A1=LEFT(B1,FIND("|",SUBSTITUTE(B1,".","|",MIN(4,LEN(B1)-LEN(SUBSTITUTE(B1,".","")))))-1)
 
Upvote 0
Assuming your format is always xx.xx.xx.xx.xx.xx the following will work:

A1=IF(LEN(B1)>11,LEFT(B1,11),LEFT(B1,LEN(B1)-3))

HTH

Miles
 
Upvote 0
Thankyou FormR,

Do you also have a formula to calculate the length of each number?
i.e.
B1 is a level 6 number (5 bits long +1)
B2 = 7
B3 = 6
B4 = 4
B5 = 5
 
Upvote 0
Do you also have a formula to calculate the length of each number?
i.e.
B1 is a level 6 number (5 bits long +1)
B2 = 7
B3 = 6
B4 = 4
B5 = 5

Hi, I don't really understand what you mean here.
 
Upvote 0
Do you also have a formula to calculate the length of each number?

Hi, if you still need help then maybe one of these options will help:


Excel 2013
ABCD
107.01.01.0107.01.01.01.0166
207.01.01.0307.01.01.03.01.0177
307.01.01.0407.01.01.04.0166
47.0207.02.0144
507.02.0407.02.04.0455
Sheet1
Cell Formulas
RangeFormula
C1=LEN(B1)-LEN(SUBSTITUTE(B1,".",""))+2
D1=1+(LEN(B1)+1)/3
 
Upvote 0

Forum statistics

Threads
1,223,740
Messages
6,174,223
Members
452,552
Latest member
Kleets

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