Counting in groups or bunches

BMR

New Member
Joined
Jul 19, 2011
Messages
21
Hey guys,

I am trying to create unique SKUs for a data set I have. What I would like to accomplish is to create a new SKU for every new product. These SKUs should be numerical but I cannot use the drag tool or a basic formula because each product takes up anywhere between 2-50 rows. Each row may depict a different color/size but it is still the same product and needs the same SKU.

Example
E1-E5: "Writing Desk"
E6-E12: "Bookcase"
E13-E50: "Barstool"

Now what I want would be...
D1-D5: "SKU10001"
D6-D12: "SKU10002"
D13-D50: "SKU10003" and so on...

I tried coming up with a COUNTIF formula but to no avail. Ideas I have about how to do it would be If E2=E1, don't count up. If E2≠E1, count. That way it checks the cell above. If the cell above is the same it doesn't count up, if the cell above is different (meaning a change in product), the SKU will count up by 1.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I had my question answered. If anyone else has the same issue, here's the solution.

in d1 put this, without quotations - "sku10001"

in d2 put this, WITH quotations - ="sku"&IF(E2=E1,RIGHT(D1,5),RIGHT(D1,5)+1) drag down
 
Upvote 0
or try this

Excel Workbook
EF
1Writing DeskSKU100001
2Writing DeskSKU100001
3Writing DeskSKU100001
4Writing DeskSKU100001
5Writing DeskSKU100001
6BookcaseSKU100002
7BookcaseSKU100002
8BookcaseSKU100002
9BookcaseSKU100002
10BookcaseSKU100002
11BookcaseSKU100002
12BookcaseSKU100002
13BarstoolSKU100003
14BarstoolSKU100003
Sheet1
Excel 2003
Cell Formulas
RangeFormula
F1="SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E1:$E$1,E1:$E$1)),"100000")
F2=IF(E2=E1,F1,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E2,E$1:$E2)),"100000"))
F3=IF(E3=E2,F2,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E3,E$1:$E3)),"100000"))
F4=IF(E4=E3,F3,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E4,E$1:$E4)),"100000"))
F5=IF(E5=E4,F4,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E5,E$1:$E5)),"100000"))
F6=IF(E6=E5,F5,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E6,E$1:$E6)),"100000"))
F7=IF(E7=E6,F6,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E7,E$1:$E7)),"100000"))
F8=IF(E8=E7,F7,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E8,E$1:$E8)),"100000"))
F9=IF(E9=E8,F8,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E9,E$1:$E9)),"100000"))
F10=IF(E10=E9,F9,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E10,E$1:$E10)),"100000"))
F11=IF(E11=E10,F10,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E11,E$1:$E11)),"100000"))
F12=IF(E12=E11,F11,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E12,E$1:$E12)),"100000"))
F13=IF(E13=E12,F12,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E13,E$1:$E13)),"100000"))
F14=IF(E14=E13,F13,"SKU"&TEXT(SUMPRODUCT(1/COUNTIF(E$1:$E14,E$1:$E14)),"100000"))
 
Upvote 0

Forum statistics

Threads
1,215,741
Messages
6,126,588
Members
449,319
Latest member
iaincmac

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