Forum

Notifications
Clear all

[Solved] attribuer un numéro unique par référence/facture, par mois, qui redémarre chaque mois

15 Posts
2 Users
2 Reactions
220 Views
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

Objectif de la formule

Créer une numérotation automatique (N° Enreg) :

  • Qui redémarre à 1 chaque mois

  • Basée sur N° Facture, ou à défaut, sur Référence

  • Sans utiliser de formule matricielle

Exemple du resultat attendu

Mois N° Facture Référence N° Enreg
Janvier F001   1
Janvier F002   2
Janvier F001   1
Janvier   R001 3
Janvier   R001 3
Février F001   1
Février   R001 2
Février F002   3
Février F002   3
 
Posted : 25/04/2025 9:41 pm
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@kna

Can't respond to you in French, sorry. From what understand is that the long formula you have is not giving the correct result. Perhaps the formula I added in the last column of the table does. If not, please show the result you want to achieve in the your file.

 

 
Posted : 26/04/2025 1:17 am
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

Merci Rincy c est bien le résultat recherche et je suis même impressionné par la simplicité de votre raison et je vous en remercie cependant pouvez vous apporter une amélioration à la formule suivante : =SI([@[N° Facture]]<>"";SIERREUR(SI(NB.SI.ENS(INDIRECT("$F$2:F"&LIGNE()-1);$F3;INDIRECT("$B$2:b"&LIGNE()-1);[@Mois])=0;NB.SI.ENS(INDIRECT("$B$2:b"&LIGNE()-1);[@Mois])+1;INDEX(Tableau1[[N° Enreg]:[Libellé]];EQUIV($F3;[N° Facture];0);1));"");SI([@Référence]<>"";SIERREUR(SI(NB.SI.ENS( INDIRECT("$G$2:g"&LIGNE()-1);$G3;INDIRECT("$B$2:b"&LIGNE()-1);[@Mois])=0;NB.SI.ENS( INDIRECT("$B$2:b"&LIGNE()-1);[@Mois])+1;INDEX(Tableau1[[N° Enreg]:[Libellé]];EQUIV($G3;[Référence];0);1));"");"")) qui se trouve dans la colonne N° Enreg afin d obtenir le même résultat. Merci d avance  

 
Posted : 26/04/2025 1:34 am
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

Desole Monsieur Riny pour l erreur sur votre nom

 
Posted : 26/04/2025 1:45 am
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@kna 

No worries!

I understand you want an improvement on your the formula you pasted. Though, it's in French and  I'm not sure it's the same as in your file. But why would you want to change a rather complex formula if mine (quite simple) seems to resolve your problem?

 
Posted : 26/04/2025 5:07 am
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

@riny En fait c est du à un melange de frustration quand je me rend compte que j ai passé des jours pour quelque chose de si complexe aussi la resolution de cette enigme me permettra de revoir mon approche et mon analyse des situations parce que je veux atteindre un niveau d efficacite similaire au votre ce n est pas encore le cas.

voici un traduction du code en anglais =IF([@[Invoice No.]]<>"";IFERROR(IF(COUNTIFS.SENS(INDIRECT("$F$2:F"&LINE()-1);$F3;INDIRECT("$B$2:b"&LINE()-1);[@Month])=0;COUNTIFS.SENS(INDIRECT("$B$2:b"&LINE()-1);[@Month])+1;INDEX(Table1[[Record No.]:[Label]];EQUIV($F3;[Invoice No.];0);1));"");IF([@Reference]<>"";IFERROR(IF(COUNTIFS.SENS( INDIRECT("$G$2:g"&ROW()-1);$G3;INDIRECT("$B$2:b"&ROW()-1);[@Month])=0;COUNTIFS( INDIRECT("$B$2:b"&ROW()-1);[@Month])+1;INDEX(Table1[[Reg No.]:[Label]];EQUIV($G3;[Reference];0);1));"");""))

 

 
Posted : 26/04/2025 7:21 am
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@kna 

OK, then that is indeed the formula you had in your file. According to my "translator" your last message reads as follows:

"In fact it is due to a mixture of frustration when I realise that I spent days for something so complex also the resolution of this enigma will allow me to review my approach and my analysis of the situations because I want to reach a level of efficiency similar to yours this is not yet the case."

I don't understand the bolded part. Your current formula is very complicated and I understand that it doesn't return the correct results, but please correct me if I'm wrong.

 
Posted : 26/04/2025 3:44 pm
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

@riny En fait je veux dire mon souhaite est d être aussi bon et efficace que vous pour l heure je n ai pas encore atteint ce niveau;

Merci pour votre excellente réponse.

 
Posted : 26/04/2025 5:14 pm
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

aussi je souhaite crée un numéro de pièce compose du code journal BDA du mois 02 et du numéro que vous avez créé 001 002 ...  010. QUAND J ESSAIE AVEC LA FONCTION CONCATENER LES NUMERO ENREGISTREMENT NE FONCTIONNE PLUS CORRECTEMENT

 
Posted : 26/04/2025 5:33 pm
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@knAPS

 

Perhaps like in column T in the attached file??

 

 
Posted : 26/04/2025 11:19 pm
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

@riny Bonjour merci pour la réponse cependant pouvez vous m explique la formule dans la colonne T pour ma compréhension.

 

 
Posted : 27/04/2025 3:20 pm
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@kna

Sure. what is does is concatenate the values from three cells using the &-sign and TEXT function to format numbers in a particular way.

The formula (English):

=[@[Code Jl]]&TEXT([@Mois],"00")&TEXT([@Column1],"000")

Step-by step:

[@[Code Jl]] takes the value from the current row (indicated by the @ sign) in column "Code J"

TEXT([@Mois],"00") takes the value from the current row in column "Mois" and converts it into a text, always with two digits. So, a 2 become "02"

TEXT([@Column1],"000") is similar to the previous step, though it converts the number to a three-digit text. Here "Column1" refers to the values in the column I added earlier. In your case you would point it to "N° Enreg".

Joint the three together with an &-sign and you get something like:

"BDA" & "02" & "001" which becomes the text "BDA02001" as shown in column T.

 

 
Posted : 27/04/2025 3:46 pm
KNA reacted
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

@riny Merci beaucoup Monsieur bon dimanche à vous et plus tard pour le prochain sujet.

 
Posted : 27/04/2025 4:50 pm
 KNA
(@kna)
Posts: 9
Active Member
Topic starter
 

@riny Bonjour Monsieur, vu la simplicité avec laquelle vous avez résolu ma difficulté pouvez me donnez la logique algorithmique que vous avez suivie par la même occasion donnez une démarche méthodologique en terme d algo pour Excel que je pourrai utiliser pour résoudre mes problèmes a l avenir.

 
Posted : 28/04/2025 11:20 pm
Riny van Eekelen
(@riny)
Posts: 1195
Member Moderator
 

@kna 

Your question in English:

"Hello Sir, given the simplicity with which you solved my problem can you give me the algorithmic logic that you followed at the same time give a methodological approach in terms of algo for Excel that I can use to solve my problems in the future."

 

Oh, that's difficult to answer. It's more based on experience than pure logic or a methodical approach. You have to know the functions, have learned about what they do. When you don't know about certain functions, you may end up using the ones you do know, but in a very complicated manner. It might work. Sometimes not. When it does work in a very complicated manner, you should expect that there's probably an easier way. That's typical Excel. Many possible solutions to one single problem. Practice makes perfect! Take a course, search the web, and ask questions on forums like this. After a while you will get a feel for the right solutions.

R

 

 

 

 

 
Posted : 29/04/2025 12:35 am
KNA reacted
Share: