check if a number in a cell has duplicate digits

jimblimm

Board Regular
in
a1
1234

a2
1123

a3
2244

a4
4443

a5
5555

i am trying to come up with a formula that will do the following
if the number in cell a1 has no duplicates, b1="s"
if the number in cell a1 has 1 duplicate, it should "1d"
if the number in cell a1 has 2 duplicate, it should "2d"
if the number in cell a1 has 3 duplicate, it should "tc"
if the number in cell a1 has all duplicate, it should "qc"

what im expecting is
b1=s
b2=1d
b3=2d
b4=tc
b5=qc

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

shg

MrExcel MVP
=LOOKUP(SUMPRODUCT(LARGE(FREQUENCY(--MID(A1, {1,2,3,4}, 1), {0,1,2,3,4,5,6,7,8,9}), {1,2}), {10,1}), {11,21,22,31,40}, {"s","1d","2d","tc","qc"})

jimblimm

Board Regular
WOW, i started to post in previous post, but thought it would be something different.
question, (in reference to the sorting post) is there a way to do the same thing alphabetically

a1
hlhl

=

b1 hhll

drsarao

Well-known Member
WOW, i started to post in previous post, but thought it would be something different.
question, (in reference to the sorting post) is there a way to do the same thing alphabetically

A bit late.
This will work:

=LOOKUP(SUMPRODUCT(LARGE(FREQUENCY(CODE(UPPER(MID(A1, {1,2,3,4}, 1)))-65, {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25}), {1,2}), {10,1}), {11,21,22,31,40}, {"s","1d","2d","tc","qc"})

Replies
2
Views
283
Replies
1
Views
199
Replies
2
Views
65
Replies
1
Views
184
Replies
1
Views
201

1,130,342
Messages
5,641,592
Members
417,224
Latest member
llama9207

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.

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

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