Repeated Digits in a CELL

hrayani

Well-known Member
Joined
Jul 23, 2010
Messages
1,522
Office Version
  1. 2016
Platform
  1. Windows
Dear All,

I am using this formula for repeated numbers in a range

=IF(COUNTIF(A1:I1,0)>1,"0","")&SUBSTITUTE(SUM((COUNTIF(A1:I1,{1,2,3,4,5,6,7,8,9})>1)*{1,2,3,4,5,6,7,8,9}*10^{8,7,6,5,4,3,2,1,0}),0,"")

i need a formula for Repeated Digits in a cell

Regards,

Humayun

 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
To make sure I understand,

If a cell contains: 23445
The result would be: 4

Or if: 22556
would be: 25

Is that correct?
 
Upvote 0
This may be a start,

=IFERROR(MID(A1,FIND(MID(A1,1,1),A1,2),1),)&IFERROR(MID(A1,FIND(MID(A1,2,1),A1,3),1),)&IFERROR(MID(A1,FIND(MID(A1,3,1),A1,4),1),)&IFERROR(MID(A1,FIND(MID(A1,4,1),A1,5),1),)&IFERROR(MID(A1,FIND(MID(A1,5,1),A1,6),1),)


I do think it may have a few problems. This handles a 5 digit number, a number like:
22245
will result in:
22

Please test to see what you think.

Cell is A1
 
Upvote 0
sorry dear

its not working

its showing #NAME ...............
 
Upvote 0
Are you using 2003?

If so, the Iferror function is not available as this was added in 2007, which is what I am using.


I will use the iserr function and repost.
 
Upvote 0
=IF(ISERR(MID(A1,FIND(MID(A1,1,1),A1,2),1)),,MID(A1,FIND(MID(A1,1,1),A1,2),1))&IF(ISERR(MID(A1,FIND(MID(A1,2,1),A1,3),1)),,MID(A1,FIND(MID(A1,2,1),A1,3),1))&IF(ISERR(MID(A1,FIND(MID(A1,3,1),A1,4),1)),,MID(A1,FIND(MID(A1,3,1),A1,4),1))&IF(ISERR(MID(A1,FIND(MID(A1,4,1),A1,5),1)),,MID(A1,FIND(MID(A1,4,1),A1,5),1))&IF(ISERR(MID(A1,FIND(MID(A1,5,1),A1,6),1)),,MID(A1,FIND(MID(A1,5,1),A1,6),1))

cell is A1
 
Upvote 0
Its working now

cell a1 = 22245

but you are right that the result is 22 whereas, it should be only 2

any idea what to do now?
 
Upvote 0
Hi Humayun

Try also:

=IF(ISNUMBER(FIND(0,A1)),"0","")&SUBSTITUTE(SUMPRODUCT(ISNUMBER(FIND({1,2,3,4,5,6,7,8,9},A1))*{1,2,3,4,5,6,7,8,9}*10^{8,7,6,5,4,3,2,1,0}),0,"")
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

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