Copy link to clipboard
Copied
I have tried every SUMIF formula on these forums. But none of them worked for me. So I really need your help to complete my formula.
W | 20,00 |
G | 80,00 |
W | 23,00 |
G | 40,00 |
W | 0,05 |
G | 2,00 |
W | 5,00 |
G | 10,00 |
W | 70,00 |
G | 45,00 |
What I am trying to do is get the total of all the amounts behind "W" and behind "G". So in this case it would be W= € 118,05 and G= € 177(These outcomres will come in "Text1.1" And in Text1.2".
The row (from top to bottom) with G and W are called "Text9" and the second row is called "Text10". In the rows there are 61 lines (Text9.1/Text9.2/Text9.3 etc).
Can somebody please help me with this formula
Copy link to clipboard
Copied
Let's say you have 10 such rows. Use this code as the custom calculation script for the field that should hold the total value for "G":
var totalG = 0;
for (var i=1; i<=10; i++) {
var v = this.getField("Text9."+i).valueAsString;
if (v=="G") totalG+=Number(this.getField("Text10."+i).valueAsString);
}
event.value = totalG;
You can adjust this code (by changing the condition in line #4 to v=="W") for the second total field.
Copy link to clipboard
Copied
Thank you it worked. Now it seems so simple. I only needed to change the amount off fields. Thank you for your effort.