PDA

View Full Version : How to create a module to find missing brands and models (look through table 1, compa



WorkGuy
06-28-2023, 07:48 AM
Hi guys!
I want to try and create a module that looks through a table, compares it to another table, and then fills out all the missing information in a third table.
I've only worked with VBA recording tool up to now, so this seems like something that is way beyond my level.
Is this something that can be done? (See picture below for details)Are there any tutorials that would make this possible for me to learn, or is this very advanced?

And also - in reality there are hundreds of customers and thousands of articles. So it wouldn't be ideal to solve it without VBA...

https://preview.redd.it/gaqdask9pr8b1.png?width=1458&format=png&auto=webp&v=enabled&17c7b70230899
https://preview.redd.it/gaqdask9pr8b1.png?width=1458&format=png&auto=webp&v=enabled&17c7b702

Paul_Hossler
06-28-2023, 02:42 PM
Welcome

Please use that instructions in my sig to attach a small workbook so that we don't have to type in all that to test

Thanks

georgiboy
06-29-2023, 05:30 AM
I have created an Excel 365 formulated option but if you don't have 365 then others on the forum can use the data I have created:

=LET(oTbl,Table1,lTbl,Table2,
s,UNIQUE(INDEX(oTbl,,1)),b, INDEX(lTbl,,1),m,INDEX(lTbl,,2),
sku,TOCOL(IF(SEQUENCE(,COUNTA(b))<=COUNTA(b),s,#N/A),3),
bra,INDEX(b, MOD(SEQUENCE(COUNTA(s)*COUNTA(b))-1, COUNTA(b))+1),
mdl,INDEX(m, MOD(SEQUENCE(COUNTA(s)*COUNTA(m))-1, COUNTA(m))+1),
tbldta,HSTACK(sku,bra,mdl),
mb,BYROW(tbldta,LAMBDA(x,COUNTIFS(INDEX(oTbl,,1),INDEX(x,,1),INDEX(oTbl,,2) ,INDEX(x,,2)))),
mm,BYROW(tbldta,LAMBDA(x,COUNTIFS(INDEX(oTbl,,1),INDEX(x,,1),INDEX(oTbl,,3) ,INDEX(x,,3)))),
cmnt,BYROW(HSTACK(mb,mm),LAMBDA(x,IF(AND(INDEX(x,,1)=0,INDEX(x,,2)>0),"BRAND MISSING",IF(AND(INDEX(x,,1)>0,INDEX(x,,2)=0),"MODEL MISSING",IF(AND(INDEX(x,,1)=0,INDEX(x,,2)=0),"BRAND AND MODEL MISSING",""))))),
HSTACK(tbldta,cmnt))