Tricky Unique ID

Bering

Board Regular
Joined
Aug 22, 2018
Messages
185
Office Version
  1. 2016
Platform
  1. Windows
Hello,

hope you guys can hep me with this problem. Below is an example of what my file looks like.

I would like to create a unique ID in column A by concatenating the Types in column C and the Product ID also in column C above each table.

So for Product A, the expected result in column A should be: 1Product A, 2ProductA and so on (or Product A1, Product A2, whatever)

Of course I have no idea how this could be achieved.

Many thanks.

ABC
Product A
TypeQuantityPriceValue
=1ProductA1
=2ProductA2
=3ProductA3
Product B
TypeQuantityPriceValue
=1ProductB1
=2ProductB2
=3ProductB3

<tbody>
</tbody>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
you can use concatenate or simply &

If I guess that C 1 is product A the 1 would be at 3 you could use in A3 = C3&$C$1 and drag down
 
Upvote 0
Thanks Mole999, the problem is that by simply fixing $C$1 and dragging down the result would not be the expected one when the product changes to Product B, Product C and so on.
My real file contains many products and that's basically how we are currently dealing with the problem: by manually changing the "
$C$1" reference every time. It is this kind of manual intervention that I would like to avoid.
 
Last edited:
Upvote 0
The only other way I can see is to add an additional column that reflects the product I can't think of an intelligent way the formula would auto adjust
 
Upvote 0
With your sheet set up like this:

Capture.jpg


Enter this formula in cell A3, and drag it down:
Code:
=IF(ISNUMBER(C3),IF(ISNUMBER(C2),C3&SUBSTITUTE(MID(A2,LEN(C2)+1,LEN(A2)-LEN(C2))," ",""),C3&SUBSTITUTE(C1," ","")),"-")

Note that your data needs to have no blank rows.
 
Upvote 0
Solution
Yep Mole999, that's why I said it was a tricky one :(
 
Last edited:
Upvote 0
Wow, that's great!!! Thank you so much brownbread!!!



With your sheet set up like this:

Capture.jpg


Enter this formula in cell A3, and drag it down:
Code:
=IF(ISNUMBER(C3),IF(ISNUMBER(C2),C3&SUBSTITUTE(MID(A2,LEN(C2)+1,LEN(A2)-LEN(C2))," ",""),C3&SUBSTITUTE(C1," ","")),"-")

Note that your data needs to have no blank rows.
 
Upvote 0
Hi again bownbread, I find your solutions fascinating.

I was wondering how your formula could be changed to work in a situation where there is a numeric code instead of Product A, Product B etc, and the types are text rather than numbers (just the opposite of what we had in my previous example).


Thanks!


With your sheet set up like this:

Capture.jpg


Enter this formula in cell A3, and drag it down:
Code:
=IF(ISNUMBER(C3),IF(ISNUMBER(C2),C3&SUBSTITUTE(MID(A2,LEN(C2)+1,LEN(A2)-LEN(C2))," ",""),C3&SUBSTITUTE(C1," ","")),"-")

Note that your data needs to have no blank rows.
 
Upvote 0
Please try at A3
=IF(OR(C3="type",C4="type",C3=""),"",C3&" "&LOOKUP(2,1/(C$2:C3="type"),C$1:C2))
 
Upvote 0
Or remove &" " if no space need between type and product
=IF(OR(C3="type",C4="type",C3=""),"",C3&LOOKUP(2,1/(C$2:C3="type"),C$1:C2))


56866473_459118637962167_2636227097806241792_n.jpg
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,978
Latest member
rrauni

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