Excel sum based on lookup of code and values in another table
up vote
0
down vote
favorite
Given 2 named tables in Excel 2013 (or higher):
tblInvoice
ID InvRef Total
1 I/123 45
2 I/234 8
tblDeliveries
ID InvRef Amt
1 I/123 10
2 I/123 15
3 I/123 20
4 I/234 5
5 I/234 3
How can we get the tblInvoice[Total]
to compute automatically using an Excel formula? i.e. in pseudocode:
tblDeliveries[Total] = SUM(tblDeliveries[Amt] WHERE MATCH InvRef)
I have tried this Excel formula in tblInvoice[InvTotal]
but it is returning an incorrect value:
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[InvRef],tblDeliveries[Amt]))
Also tried swapping the first and second parameters. Produces a different amount, but still incorrect:
=SUMPRODUCT(SUMIF([InvRef],tblDeliveries[InvRef],tblDeliveries[Amt]))
If relevant, it is assumed that there is a 1:N relationship from tblInvoice[InvRef]
:tblDeliveries[InvRef]
and that tblInvoice[InvRef]
is UNIQUE.
excel excel-formula excel-2013 excel-2016
add a comment |
up vote
0
down vote
favorite
Given 2 named tables in Excel 2013 (or higher):
tblInvoice
ID InvRef Total
1 I/123 45
2 I/234 8
tblDeliveries
ID InvRef Amt
1 I/123 10
2 I/123 15
3 I/123 20
4 I/234 5
5 I/234 3
How can we get the tblInvoice[Total]
to compute automatically using an Excel formula? i.e. in pseudocode:
tblDeliveries[Total] = SUM(tblDeliveries[Amt] WHERE MATCH InvRef)
I have tried this Excel formula in tblInvoice[InvTotal]
but it is returning an incorrect value:
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[InvRef],tblDeliveries[Amt]))
Also tried swapping the first and second parameters. Produces a different amount, but still incorrect:
=SUMPRODUCT(SUMIF([InvRef],tblDeliveries[InvRef],tblDeliveries[Amt]))
If relevant, it is assumed that there is a 1:N relationship from tblInvoice[InvRef]
:tblDeliveries[InvRef]
and that tblInvoice[InvRef]
is UNIQUE.
excel excel-formula excel-2013 excel-2016
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Given 2 named tables in Excel 2013 (or higher):
tblInvoice
ID InvRef Total
1 I/123 45
2 I/234 8
tblDeliveries
ID InvRef Amt
1 I/123 10
2 I/123 15
3 I/123 20
4 I/234 5
5 I/234 3
How can we get the tblInvoice[Total]
to compute automatically using an Excel formula? i.e. in pseudocode:
tblDeliveries[Total] = SUM(tblDeliveries[Amt] WHERE MATCH InvRef)
I have tried this Excel formula in tblInvoice[InvTotal]
but it is returning an incorrect value:
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[InvRef],tblDeliveries[Amt]))
Also tried swapping the first and second parameters. Produces a different amount, but still incorrect:
=SUMPRODUCT(SUMIF([InvRef],tblDeliveries[InvRef],tblDeliveries[Amt]))
If relevant, it is assumed that there is a 1:N relationship from tblInvoice[InvRef]
:tblDeliveries[InvRef]
and that tblInvoice[InvRef]
is UNIQUE.
excel excel-formula excel-2013 excel-2016
Given 2 named tables in Excel 2013 (or higher):
tblInvoice
ID InvRef Total
1 I/123 45
2 I/234 8
tblDeliveries
ID InvRef Amt
1 I/123 10
2 I/123 15
3 I/123 20
4 I/234 5
5 I/234 3
How can we get the tblInvoice[Total]
to compute automatically using an Excel formula? i.e. in pseudocode:
tblDeliveries[Total] = SUM(tblDeliveries[Amt] WHERE MATCH InvRef)
I have tried this Excel formula in tblInvoice[InvTotal]
but it is returning an incorrect value:
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[InvRef],tblDeliveries[Amt]))
Also tried swapping the first and second parameters. Produces a different amount, but still incorrect:
=SUMPRODUCT(SUMIF([InvRef],tblDeliveries[InvRef],tblDeliveries[Amt]))
If relevant, it is assumed that there is a 1:N relationship from tblInvoice[InvRef]
:tblDeliveries[InvRef]
and that tblInvoice[InvRef]
is UNIQUE.
excel excel-formula excel-2013 excel-2016
excel excel-formula excel-2013 excel-2016
asked Nov 10 at 14:35
Adam
7781436
7781436
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[@InvRef],tblDeliveries[Amt]))
The @ is the crucial difference.
Regards
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[@InvRef],tblDeliveries[Amt]))
The @ is the crucial difference.
Regards
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
add a comment |
up vote
2
down vote
accepted
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[@InvRef],tblDeliveries[Amt]))
The @ is the crucial difference.
Regards
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[@InvRef],tblDeliveries[Amt]))
The @ is the crucial difference.
Regards
The syntax is incorrect for what you require.
=SUMPRODUCT(SUMIF(tblDeliveries[InvRef],[@InvRef],tblDeliveries[Amt]))
The @ is the crucial difference.
Regards
edited Nov 10 at 16:27
answered Nov 10 at 14:50
XOR LX
6,9891813
6,9891813
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
add a comment |
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
I am not used to table references. Can you explain what the @ does?
– Forward Ed
Nov 10 at 15:47
1
1
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
It instructs the formula to look at the value in the referenced column within the same row as that in which the formula resides. Without it, you are referencing the entire column.
– XOR LX
Nov 10 at 15:49
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
Marvellous!!! Thank you so much!!! :)
– Adam
Nov 10 at 16:05
You're very welcome!
– XOR LX
Nov 10 at 16:26
You're very welcome!
– XOR LX
Nov 10 at 16:26
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239987%2fexcel-sum-based-on-lookup-of-code-and-values-in-another-table%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password