SOLVED

Automatiser une tache en utilisant somme.si

Copper Contributor

Bonjour la communauté, 

 

Je suis novice avec Excel et je tente de créer une formule pour chercher une valeur dans un tableau, puis, si elle s'y trouve, de donner un résultat. 

Dans le fichier, ID_EX1 et ID_EX2 sont les identifiants des nœuds et ils représentent les extrémités des conduites. Q_EX1 et Q_EX2 sont les valeurs de débits correspondants respectivement à ID_EX1 et ID_Ex2. Id_noeud est l'identifiant unique de chaque nœud (c'est-à-dire si un identifiant existe plusieurs fois dans ID_EX1 et ID_EX2 je le note une seule fois dans Id_noeud). Le but de mon travail est de calculer le débit Q (qui est somme des Q_EX1et Q_EX2) pour chaque nœud comme suit: chaque Id_noeud ne doit pas apparaitre que 3 fois entre ID_EX1 et ID_EX2, s'il n'est pas le cas donc il existe des valeurs de Q_EX1 et Q_EX2 qui sont égaux, je compte pour Q soit Q_EX1 soit Q_EX2. Pour cela, j'ai utiliser la fonction somme.si mais je dois introduire le critère ("= Id_noeud") chaque fois ainsi que travailler avec les colonnes ID_EX1 et ID_EX2 chacune à part. y a-t-il une formule pour calculer le débit Q automatiquement car les fichiers Excel avec lesquels j'ai travaillé sont très volumineux.

 

Merci de m'aider.

 

Cordialement.

 

8 Replies

@Belsam_mzh Perhaps like in the attached file?

Screenshot 2021-07-17 at 20.51.44.png

Merci infiniment pour votre réponse. vous pouvez rendre le critère de somme automatique mais pourriez vous m'aider à faire ce travail sur toute la matrice composée de 4 colonnes ID_EX1, Q_EX1, ID_EX2 et Q_EX2.

@Belsam_mzh Sorry, don't understand the question. What would you like see in column I?

@Riny_van_Eekelen  Pour la colonne I je veux calculer la somme des débits Q_EX1 et Q_EX2 si les identifiants ID_EX1 et ID_EX2 égalent ID_noeud. J'ai travaillé avec la formule "=SOMME.SI(D:D;H3;E:E)+SOMME.SI(F:F;H:H;G:G)", le problème est Id_noeud peut apparaitre plus que 3 fois entre ID_EX1 et ID_EX2 s'il est le cas donc il existe des Q_EX1 et Q_EX2 qui sont égaux et je dois compter pour la somme soit Q_EX1 soit Q_EX2. Vous trouvez deux exemples dans ce fichier.

@Belsam_mzh Still don't understand what you are talking about. By the way the formula in K7 seems to be wrong it sums two different ID's.

 

A formula like:

=SOMME.SI(D:D;H3;E:E)+SUMIF(F:F;H3;G:G)

 

in J3 will SUM values from columns E and G where the IDs in columns D and F match the for ID in column H.

@Riny_van_Eekelen@Riny_van_Eekelen

Vous avez raison pour k7 j'ai le corrigé.

Pour l'identifiant 1229144 les valeurs de Q_EX1 et Q_EX2 sont les mêmes E13=G4 , E14=G5 et E15=G6 donc je vais sommer pour I juste 3 valeurs et non pas les 6.

Dans la formule chaque ID dois être répéter au maximum trois fois et si un même identifiant existe plus que 3 fois dans entre ID_EX1 et ID_EX2 je passe à comparer les Q_EX1 et Q_EX2,

si ID_EX1 = ID_EX2 et Q_EX1=Q_EX2 pour Q je compte soit Q_EX1 soit Q_EX2

 

best response confirmed by allyreckerman (Microsoft)
Solution

@Belsam_mzh Okay! That complicates the matter. I would put all ID's and Values in one list with an extra column for the Q-Ex-number. Then separate and focus on all IDs that exist more than three times. Remove the duplicates (i.e. where ID-1 & Q-1 equals ID-2 & Q-2). Then you are (probably) left with no more than three IDs, that you can re-join with the other data. Now you can do the SUMIF formula (SOMME.SI) as there will not be any ID with more than 3 occurrences. 

 

Not something you do in one simple formula, I'm afraid. At least, not one I can think of right now. Personally, I would use PowerQuery. Although not difficult to learn, perhaps a bit overwhelming since you mention to be new to Excel.

 

Have added a few chaat to your file demonstrating the steps you may have to do. Use only a very small portion of the data though.

Merci beaucoup pour votre réponse et votre temps .
1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@Belsam_mzh Okay! That complicates the matter. I would put all ID's and Values in one list with an extra column for the Q-Ex-number. Then separate and focus on all IDs that exist more than three times. Remove the duplicates (i.e. where ID-1 & Q-1 equals ID-2 & Q-2). Then you are (probably) left with no more than three IDs, that you can re-join with the other data. Now you can do the SUMIF formula (SOMME.SI) as there will not be any ID with more than 3 occurrences. 

 

Not something you do in one simple formula, I'm afraid. At least, not one I can think of right now. Personally, I would use PowerQuery. Although not difficult to learn, perhaps a bit overwhelming since you mention to be new to Excel.

 

Have added a few chaat to your file demonstrating the steps you may have to do. Use only a very small portion of the data though.

View solution in original post