Ref code based on cell

anoop0085

New Member
Joined
Aug 4, 2022
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Dear All ;

Could you please help me to create a formula on column j based on column A (type) .This will help me to create a product code which is unique . please keep in mind that i am using 2016 , not new version

Marine Spare Log.xlsx
ABCDEFGHJ
2TypeItem DescpBrandsSupplier UnitsQty in HandBox LocationMinimum
3O_RINGSO-RING -MIL SPEC NAS 1611-03 EP - 30857SEABIRDUNKNOWNEACH14BOX 091O_RINGS_001
4O_RINGSO-RING -PARKER 2- 133 N674 -30858SEABIRDUNKNOWNEACH7BOX 091O_RINGS_002
5O_RINGSO-RING -PARKER 2- 130 N674 -31322SEABIRDUNKNOWNEACH14BOX 091O_RINGS_003
6O_RINGSO-RING -OF ANTIFOULING -30097SEABIRDUNKNOWNEACH7BOX 091O_RINGS_004
7O_RINGSO-RING -PH TEFLON JUNCTIONSEABIRD-PHUNKNOWNEACH8BOX 091O_RINGS_005
8O_RINGSO-RING -PARKER 2- 110 N674 -30498SEABIRDUNKNOWNEACH14BOX 091O_RINGS_006
9O_RINGSO-RING -SPACER, SHOULDER, #10, NYLONN -311242SEABIRDUNKNOWNEACH14BOX 091O_RINGS_007
10O_RINGSO-RING -ELECTRONIC CANISTER PISTON SEALUNKNOWNUNKNOWNEACH6BOX 091O_RINGS_008
11O_RINGSO-RING -ELECTRONIC CANISTER FACE SEALUNKNOWNUNKNOWNEACH6BOX 091O_RINGS_009
12O_RINGSO-RING -BATTERY CANISTER PISTON SEALUNKNOWNUNKNOWNEACH6BOX 091O_RINGS_010
13O_RINGSO-RING -BATTERY CANISTER FACE SEALUNKNOWNUNKNOWNEACH6BOX 091O_RINGS_011
14SCREWMACH SCREW, 10- 24X7/8, FH -31811SEABIRDUNKNOWNEACH7BOX 091SCREW_001
15SCREWCAP SCREW, 8-32X 5/8" SH -31513SEABIRDUNKNOWNEACH21BOX 091SCREW_002
16SCREWCAP SCREW, 8-32X 1/4" SH -31755SEABIRDUNKNOWNEACH7BOX 091SCREW_003
17SCREWMACH SCREW, 10- 24X7/16, PH -311663SEABIRDUNKNOWNEACH28BOX 091SCREW_004
18SCREWMACH SCREW, 10-24 X 9/16 PH SS -30174SEABIRDUNKNOWNEACH14BOX 091SCREW_005
19OTHERSSHIPPING STIKERSEABIRDUNKNOWNEACH6BOX 091OTHERS_001
20WIPERBLADE, WIPER, POP- IN, HCO (MAA -907939)SEABIRDUNKNOWNEACH14BOX 091WIPER_001
21OTHERSSYRINGE BIG WITH TEFLON TUBES USED FOR CALIBRATION -30521SEABIRD-PHUNKNOWNEACH3BOX 091OTHERS_002
22OTHERSSYRINGE SMALL USED FOR PH MAINTENANCESEABIRD-PHUNKNOWNEACH8BOX 091OTHERS_003
23TOOLSTEFLON JUNCTION SCREW DRIVESEABIRD-PHUNKNOWNEACH8BOX 091
24SOLUTIONSATURATED KCL & AGCL HYDROLAB-005308HYSEABIRD-PHUNKNOWNBOTTLE8BOX 091
Actual Stock
Cell Formulas
RangeFormula
F3:F24F3=SUMIF('Spare inbound'!$D$3:$D$1000,'Actual Stock'!B3,'Spare inbound'!$E$3:$E$1000)-SUMIF('Spare Outbound'!$C$3:$C$1000,'Actual Stock'!B3,'Spare Outbound'!$E$3:$E$1000)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
@anoop0085 Try =A2&"_"&TEXT(COUNTIF(A$2:A2,A2),"000") in J2 and copy down?

Hope that helps.
 
Upvote 0
Solution
What about VBA
VBA Code:
Option Explicit

Sub test()
    Dim a
    Dim i&
    a = Cells(1).CurrentRegion.Resize(, 1)
    With CreateObject("scripting.dictionary")
        For i = 2 To UBound(a)
            If Not .exists(a(i, 1)) Then
                .Item(a(i, 1)) = 1
                     a(i, 1) = a(i, 1) & "_" & IIf(.Item(a(i, 1)) > 9, "0", "00") & .Item(a(i, 1))
                Else
                 .Item(a(i, 1)) = .Item(a(i, 1)) + 1
                 a(i, 1) = a(i, 1) & "_" & IIf(.Item(a(i, 1)) > 9, "0", "00") & .Item(a(i, 1))
            End If
        Next
    End With
    [i1].Resize(UBound(a)) = a
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,934
Members
449,094
Latest member
teemeren

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