Home

Creating ID based on numerous cell content

%3CLINGO-SUB%20id%3D%22lingo-sub-469334%22%20slang%3D%22en-US%22%3ECreating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-469334%22%20slang%3D%22en-US%22%3E%3CP%3EHiya%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20know%20how%20to%20generate%20a%20running%20ID%20(being%201%2C%202%2C%203%20etc)%20based%20on%20column%20information%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20ID1%20to%20read%201%20for%20the%20first%20Shot%20%23%20read%20according%20to%20the%20date%20(01%2F04%2F2019).%20Then%202%20for%20the%20next%20unique%20shot%20%23%20read.%20Every%20shot%20%23%20on%20any%20given%20date%20will%20have%20the%20same%20ID.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20then%20needs%20to%20apply%20to%20ID2%20but%20based%20on%20the%20Product%20adjacent%20to%20the%20shot%2Fdate.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20below%20table%20is%20how%20I%20would%20like%20to%20ID's%20to%20read%2C%20I%20just%20need%20the%20ID's%20to%20generate%20themselves%20rather%20than%20be%20populated%20by%20manual%20input...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3EDate%3C%2FTD%3E%3CTD%3EID1%3C%2FTD%3E%3CTD%3EShot%20%23%3C%2FTD%3E%3CTD%3EID2%3C%2FTD%3E%3CTD%3EProduct%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E1%2F04%2F2019%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3CTD%3EABC%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3CTD%3E100200%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CT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C%2FTR%3E%3CTR%3E%3CTD%3E2%2F04%2F2019%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3CTD%3EABC%3C%2FTD%3E%3CTD%3E2%3C%2FTD%3E%3CTD%3E300400%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20%3A)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-469334%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-469623%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-469623%22%20slang%3D%22en-US%22%3EIt%20seems%20that%20ID2%20for%20Product%20200100%20on%201%2F04%2F2019%20and%20Product%20300400%20on%202%2F04%2F2019%20should%20be%203%20instead%20of%202.%20Please%20clarify.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-473353%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-473353%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%20ID2%20is%20unique%20to%20ID1%20%26amp%3B%20the%20date.%20So%20200100%20is%20the%20second%20product%20adjacent%20to%20ABC%20on%20the%2001%2F04%2F2019%20as%20is%20300400%20on%20the%2002%2F04%2F2018%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-478992%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-478992%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%20does%20my%20response%20make%20sense%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-479063%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-479063%22%20slang%3D%22en-US%22%3EI%20will%20study%20the%20logic%20of%20the%20needed%20formulas%2C%20especially%20ID2.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-479192%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-479192%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you!!%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-480979%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-480979%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20the%20attached%20file%2C%20the%20formula%20for%20ID1%20in%20B2%2C%20copied%20down%20rows%2C%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24A2%26lt%3B%26gt%3B%24A1%2C1%2C%3CBR%20%2F%3EIFERROR(LOOKUP(2%2C1%2F((%24A%241%3A%24A1%3D%24A2)*(%24C%241%3A%24C1%3D%24C2))%2C%24B%241%3A%24B1)%2C%3CBR%20%2F%3ELOOKUP(2%2C1%2F(%24A%241%3A%24A1%3D%24A2)%2C%24B%241%3A%24B1)%2B1))%3C%2FP%3E%3CP%3EConversely%2C%20the%20formula%20for%20ID2%20in%20D2%2C%20copied%20down%20rows%2C%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24A2%26lt%3B%26gt%3B%24A1%2C1%2C%3CBR%20%2F%3EIFERROR(LOOKUP(2%2C1%2F((%24A%241%3A%24A1%3D%24A2)*(%24C%241%3A%24C1%3D%24C2)*(%24E%241%3A%24E1%3D%24E2))%2C%24D%241%3A%24D1)%2C%3CBR%20%2F%3EIFERROR(LOOKUP(2%2C1%2F((%24A%241%3A%24A1%3D%24A2)*(%24C%241%3A%24C1%3DC2))%2C%24D%241%3A%24D1)%2B1%2C1)))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481652%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481652%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20great%20thank%20you.%20ID2%20works%20perfectly%2C%20however%20I%20found%20an%20issue%20with%20ID1.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20refer%20to%20the%20attached%20file%20as%20an%20example%20-%20If%20the%20shots%20aren't%20in%20order%2C%20as%20the%20orange%20highlighted%20cells%20are%2C%20ID1%20doesn't%20flow%20numerically.%20As%20you%20can%20see%20in%20the%20yellow%20highlighted%20cells%20the%20third%20shot%20listed%20(MER0342)%20on%20the%2004%2F01%2F2019%20has%20been%20recognised%20as%20ID%20%232%20where%20it%20should%20be%20recognised%20as%20ID%20%233%20...%20Does%20this%20make%20sense%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20provided%20another%20example%20using%20the%205th%20%26amp%3B%206th%20highlighting%20how%20the%20order%20changes%20the%20sequence%20of%20ID%20%23%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481673%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481673%22%20slang%3D%22en-US%22%3EYou%20have%20to%20manually%20fill%20in%20Columns%20G%20and%20I%20so%20that%20I%20can%20understand%20the%20logic%20that%20will%20return%20your%20desired%20results.%20Thereafter%2C%20attach%20your%20sample%20file%20with%20those%20columns%20completely%20filled%20in.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481675%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481675%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3Eplease%20see%20attached%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481735%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481735%22%20slang%3D%22en-US%22%3E%3CP%3EAlthough%20the%20dates%20are%20not%20entered%20chronologically%2C%20the%20formulas%20must%20still%20conform%20to%20the%20same%20logic.%20Thus%2C%20ID1%20for%20Shots%20TES0416%20and%20MER0342%20must%20be%203%20and%204%2C%20respectively%2C%20because%20they%20are%20the%203rd%20and%204th%20unique%20Shots%20on%201%2F4%2F2019.%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20attached%20file%2C%20I%20simply%20entered%201%20in%20B2%20and%20D2.%20The%20formula%20in%20B3%2C%20copied%20down%20rows%2C%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24A3%26lt%3B%26gt%3B%24A2%2C1%2C%3CBR%20%2F%3EIFERROR(LOOKUP(2%2C1%2F((%24A%242%3A%24A2%3D%24A3)*(%24C%242%3A%24C2%3D%24C3))%2C%24B%242%3A%24B2)%2C%3CBR%20%2F%3EMAX(INDEX((%24A%242%3A%24A2%3D%24A3)*%24B%242%3A%24B2%2C0))%2B1))%3C%2FP%3E%3CP%3EConversely%2C%20the%20formula%20in%20D3%2C%20copied%20down%20rows%2C%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3DIF(%24A3%26lt%3B%26gt%3B%24A2%2C1%2C%3CBR%20%2F%3EIFERROR(LOOKUP(2%2C1%2F((%24A%242%3A%24A2%3D%24A3)*(%24C%242%3A%24C2%3D%24C3)*(%24E%242%3A%24E2%3D%24E3))%2C%24D%242%3A%24D2)%2C%3CBR%20%2F%3EMAX(INDEX((%24A%242%3A%24A2%3D%24A3)*(%24C%242%3A%24C2%3DC3)*%24D%242%3A%24D2%2C0))%2B1))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-483883%22%20slang%3D%22en-US%22%3ERe%3A%20Creating%20ID%20based%20on%20numerous%20cell%20content%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-483883%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E!%3C%2FP%3E%3C%2FLINGO-BODY%3E
El1-_321
Occasional Contributor

Hiya,

 

Does anyone know how to generate a running ID (being 1, 2, 3 etc) based on column information?

 

I need ID1 to read 1 for the first Shot # read according to the date (01/04/2019). Then 2 for the next unique shot # read. Every shot # on any given date will have the same ID.

 

This then needs to apply to ID2 but based on the Product adjacent to the shot/date.

 

The below table is how I would like to ID's to read, I just need the ID's to generate themselves rather than be populated by manual input...

 

DateID1Shot #ID2Product
1/04/20191ABC1100200
1/04/20191ABC1100200
1/04/20192DEF1100200
1/04/20192DEF2300400
1/04/20191ABC2200100
2/04/20191ABC1200200
2/04/20192GHI1200200
2/04/20192GHI2400500
2/04/20193DEF1200200
2/04/20191ABC2300400

 

Thank you :)

 

@Twifoo

@Sergei Baklan 

 

12 Replies
It seems that ID2 for Product 200100 on 1/04/2019 and Product 300400 on 2/04/2019 should be 3 instead of 2. Please clarify.

@Twifoo 

 

Hi, ID2 is unique to ID1 & the date. So 200100 is the second product adjacent to ABC on the 01/04/2019 as is 300400 on the 02/04/2018

Hi @Twifoo does my response make sense? 

I will study the logic of the needed formulas, especially ID2.

Thank you!! @Twifoo 

In the attached file, the formula for ID1 in B2, copied down rows, is: 

=IF($A2<>$A1,1,
IFERROR(LOOKUP(2,1/(($A$1:$A1=$A2)*($C$1:$C1=$C2)),$B$1:$B1),
LOOKUP(2,1/($A$1:$A1=$A2),$B$1:$B1)+1))

Conversely, the formula for ID2 in D2, copied down rows, is: 

=IF($A2<>$A1,1,
IFERROR(LOOKUP(2,1/(($A$1:$A1=$A2)*($C$1:$C1=$C2)*($E$1:$E1=$E2)),$D$1:$D1),
IFERROR(LOOKUP(2,1/(($A$1:$A1=$A2)*($C$1:$C1=C2)),$D$1:$D1)+1,1)))

Hi @Twifoo 

 

This is great thank you. ID2 works perfectly, however I found an issue with ID1.

 

Please refer to the attached file as an example - If the shots aren't in order, as the orange highlighted cells are, ID1 doesn't flow numerically. As you can see in the yellow highlighted cells the third shot listed (MER0342) on the 04/01/2019 has been recognised as ID #2 where it should be recognised as ID #3 ... Does this make sense?

 

I have provided another example using the 5th & 6th highlighting how the order changes the sequence of ID #

You have to manually fill in Columns G and I so that I can understand the logic that will return your desired results. Thereafter, attach your sample file with those columns completely filled in.

Although the dates are not entered chronologically, the formulas must still conform to the same logic. Thus, ID1 for Shots TES0416 and MER0342 must be 3 and 4, respectively, because they are the 3rd and 4th unique Shots on 1/4/2019. 

In the attached file, I simply entered 1 in B2 and D2. The formula in B3, copied down rows, is: 

=IF($A3<>$A2,1,
IFERROR(LOOKUP(2,1/(($A$2:$A2=$A3)*($C$2:$C2=$C3)),$B$2:$B2),
MAX(INDEX(($A$2:$A2=$A3)*$B$2:$B2,0))+1))

Conversely, the formula in D3, copied down rows, is: 

=IF($A3<>$A2,1,
IFERROR(LOOKUP(2,1/(($A$2:$A2=$A3)*($C$2:$C2=$C3)*($E$2:$E2=$E3)),$D$2:$D2),
MAX(INDEX(($A$2:$A2=$A3)*($C$2:$C2=C3)*$D$2:$D2,0))+1))

You're very much welcome!
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
23 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies