Index/Match/Vlookup - No Duplicates

kaemerso

New Member
Joined
Oct 26, 2017
Messages
10
I am trying to create a smart #.

So far I have tried using the concatenate function alongside v-lookup. As well as a variation of index/match nested within if statements.

I either get an error (tried iferror), n/a (tried ifna) or #ref , which means the range is probably wrong.

Attached is a sample worksheet:
If anyone could offer some advice that would be helpful.

[TABLE="width: 435"]
<colgroup><col></colgroup><tbody>[TR]
[TD]

Ex: Whenever 1E is selected then 1E01 is returned, whenever 1E is selected again - then 1E02 is returned (Unique Value)

1E and 1C are static whereas 01,02, etc increases each time they are selected so they stay unique.

Code:
[TABLE="width: 967"]
<colgroup><col><col span="10"></colgroup><tbody>[TR]
[TD]FOLDER ID[/TD]
[TD]01[/TD]
[TD]02[/TD]
[TD]03[/TD]
[TD]04[/TD]
[TD]05[/TD]
[TD]06[/TD]
[TD]07[/TD]
[TD]08[/TD]
[TD]09[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]1E[/TD]
[TD]1E01[/TD]
[TD]1E02[/TD]
[TD]1E03[/TD]
[TD]1E04[/TD]
[TD]1E05[/TD]
[TD]1E06[/TD]
[TD]1E07[/TD]
[TD]1E08[/TD]
[TD]1E09[/TD]
[TD]1E10[/TD]
[/TR]
[TR]
[TD]1C[/TD]
[TD]1C01[/TD]
[TD]1C02[/TD]
[TD]1C03[/TD]
[TD]1C04[/TD]
[TD]1C05[/TD]
[TD]1C06[/TD]
[TD]1C07[/TD]
[TD]1C08[/TD]
[TD]1C09[/TD]
[TD]1C10[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 967"]
<colgroup><col><col span="10"></colgroup><tbody>[TR]
[TD][CODE][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="width: 268"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Selected Folder ID[/TD]
[TD]Output Should be [/TD]
[/TR]
[TR]
[TD]1E[/TD]
[TD]1E01[/TD]
[/TR]
[TR]
[TD]1E[/TD]
[TD]1E02[/TD]
[/TR]
[TR]
[TD]1E[/TD]
[TD]1E03[/TD]
[/TR]
[TR]
[TD]2C[/TD]
[TD]2C01[/TD]
[/TR]
[TR]
[TD]2C[/TD]
[TD]2C02[/TD]
[/TR]
[TR]
[TD]3E[/TD]
[TD]3E01[/TD]
[/TR]
[TR]
[TD]3C[/TD]
[TD]3C01[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I do not have permission to post a workbook or edit my original text - this is the gist of what I am searching for though.
 
Upvote 0
Something like this?
Excel Workbook
ABCDEFGHIJK
1FOLDER ID01020304050607080910
21E1E011E021E031E041E051E061E071E081E091E10
31C1C011C021C031C041C051C061C071C081C091C10
42C2C012C022C032C042C052C062C072C082C092C10
53E3E013E023E033E043E053E063E073E083E093E10
63C3C013C023C033C043C053C063C073C083C093C10
7
8
9FOLDER ID
101E1E01
111E1E02
121E1E03
132C2C01
142C2C02
153E3E01
163C3C01
171E1E04
Sheet
 
Upvote 0
Something like this?

ABCDEFGHIJK
1E
1C1C011C021C031C041C051C061C071C081C091C10
2C2C012C022C032C042C052C062C072C082C092C10
3E
3C3C013C023C033C043C053C063C073C083C093C10
1E
1E
1E
2C
2C
3E
3C
1E

<colgroup><col style="width:30px; "><col style="width:80px;"><col style="width:84px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]FOLDER ID[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]01[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]02[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]03[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]04[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]05[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]06[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]07[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]08[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]09[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: right"]1E01[/TD]
[TD="align: right"]1E02[/TD]
[TD="align: right"]1E03[/TD]
[TD="align: right"]1E04[/TD]
[TD="align: right"]1E05[/TD]
[TD="align: right"]1E06[/TD]
[TD="align: right"]1E07[/TD]
[TD="align: right"]1E08[/TD]
[TD="align: right"]1E09[/TD]
[TD="align: right"]1E10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="align: right"]3E01[/TD]
[TD="align: right"]3E02[/TD]
[TD="align: right"]3E03[/TD]
[TD="align: right"]3E04[/TD]
[TD="align: right"]3E05[/TD]
[TD="align: right"]3E06[/TD]
[TD="align: right"]3E07[/TD]
[TD="align: right"]3E08[/TD]
[TD="align: right"]3E09[/TD]
[TD="align: right"]3E10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]FOLDER ID[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]10[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]1E01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]11[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]1E02[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]12[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]1E03[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]13[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]2C01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]14[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]2C02[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]15[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]3E01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]16[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] "]3C01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]17[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: right"]1E04[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B10=INDEX($B$2:$K$6,MATCH($A10,$A$2:$A$6,0),COUNTIF($A$10:A10,A10))
B11=INDEX($B$2:$K$6,MATCH($A11,$A$2:$A$6,0),COUNTIF($A$10:A11,A11))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


PERFECT! Thank you so much. I would've never thought to use the count-if function!! I saw a couple of examples online but it just confused me even further. I have been at this since 9AM this morning.

Many thanks again!
 
Upvote 0
You're welcome. Here's another option that may work for you.
Excel Workbook
AB
1FOLDER ID
21E1E01
31E1E02
41E1E03
52C2C01
62C2C02
73E3E01
83C3C01
91E1E04
Sheet
 
Upvote 0
You're welcome. Here's another option that may work for you.

AB

<colgroup><col style="width:30px; "><col style="width:84px;"><col style="width:64px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] , align: center"]FOLDER ID[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "] [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: center"]1E[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]1E01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: center"]1E[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]1E02[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: center"]1E[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]1E03[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: center"]2C[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]2C01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: center"]2C[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]2C02[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
[TD="align: center"]3E[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]3E01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]8[/TD]
[TD="align: center"]3C[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]3C01[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]9[/TD]
[TD="align: center"]1E[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ffff00]#ffff00[/URL] , align: center"]1E04[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B2=A2&TEXT(COUNTIF($A$2:A2,A2),"0#")

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


Works just as well!
Just for educational purposes - is the "0#" changing the numbers to a string for the text formula to work?
 
Upvote 0
Yes. The "0#" puts a 0 in front of the numbers 1 through 9. Without it you would get 1E1, 1E2, etc. as below.
Excel Workbook
AB
1FOLDER ID
21E1E1
31E1E2
41E1E3
52C2C1
62C2C2
73E3E1
83C3C1
91E1E4
Sheet
 
Upvote 0
Is there any way to loop this in VBA? I have no idea how to make loops in vba - each time i just confuse myself? Any help would be much appreciated! Thank you.

So far I have:

Code:
Private Sub TextBox3_Change()


TextBox5.value = WorksheetFunction.IfError(Worksheets("Sheet1"), WorksheetFunction.Index(Worksheets("Sheet1").Range("b2:d29"), WorksheetFunction.Match(Worksheets("Sheet1"), "L50", ("a2:a29"), 0, WorksheetFunction.CountIf(Worksheets("Sheet1").Range("$l$50:l50"), "L50", ""), "")))

Each time data is entered I would like that unique ID as a "confirmation" number - essentially?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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