Calculate the sum by taking the relationship with the tables

sysuserwindows

New Member
Joined
Jan 16, 2022
Messages
16
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
Hi everyone,

I need to calculate the sum of a column quantity to Article material in Table 3 for each product material in Table 1, column A when Group in table 2 equals Group in table 3
Example: sum of (material article 2000) = 80+60+45+150 in table 3 (4 rows highlighted with color, excluding Group 20 and 21, because they don't exist in table 2) this is related to the three tables.

The formula in the Column issue quantity Column D for each Article material

sum.png
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try...

D2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

Excel Formula:
=INDEX($G$12:$G$27,MATCH(1,IF($H$12:$H$27=VLOOKUP(A2,$F$3:$G$6,2,0),IF($F$12:$F$27=B2,1)),0))

By the way, in future, please post your data as text or use the XL2BB add-in to do so instead of posting an image. This way people can easily copy and paste the data into their worksheet and work with it.

Hope this helps!
 
Upvote 0
Try...

D2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

Excel Formula:
=INDEX($G$12:$G$27,MATCH(1,IF($H$12:$H$27=VLOOKUP(A2,$F$3:$G$6,2,0),IF($F$12:$F$27=B2,1)),0))

By the way, in future, please post your data as text or use the XL2BB add-in to do so instead of posting an image. This way people can easily copy and paste the data into their worksheet and work with it.

Hope this helps!

Domenic, Thank you for your reply
but this formula looking at the value doesn't calculate the SUM of article material

Book1.xlsx
ABCDEFGH
1Product MaterialArticle MaterialdescriptionProduct MaterialGroup
2PR111000Article 120PR1115
3PR112000Article 245PR1116
4PR113000Article 360PR1117
5PR114000Article 4#N/APR1218
6PR115000Article 550PR1219
7PR122000Article 680
8PR126000Article 7100
9PR127000Article 870
10PR129000Article 955
11Article MaterialquantityGroup
1210002015
1310001515
1410004017
1520008018
1630002017
1720006017
1850005015
1950007015
2020004515
2130006015
22600010018
2370007018
2490005518
25200015019
26200025020
2720003021
Sheet1
Cell Formulas
RangeFormula
B3:B6B3=B2+1000
D2:D10D2=INDEX($G$12:$G$27,MATCH(1,IF($H$12:$H$27=VLOOKUP(A2,$F$2:$G$6,2,0),IF($F$12:$F$27=B2,1)),0))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Sorry, my mistake. I now see that you did want the sum of quantity. In that case, try the following formula instead...

Excel Formula:
=SUM(IF($H$12:$H$27=VLOOKUP(A2,$F$2:$G$6,2,0),IF($F$12:$F$27=B2,$G$12:$G$27)))

Hope this helps!
 
Upvote 0
Sorry, my mistake. I now see that you did want the sum of quantity. In that case, try the following formula instead...

Excel Formula:
=SUM(IF($H$12:$H$27=VLOOKUP(A2,$F$2:$G$6,2,0),IF($F$12:$F$27=B2,$G$12:$G$27)))

Hope this helps!

This formula calculates when the same Group , does not work with a different group for example, article material 2000 SUM = 80+60+45+150 with a different group in Table 3 (F12:H27) (groups existing in table 2 (F2:G6))

Book1.xlsx
ABCDEFGH
1Product MaterialArticle MaterialdescriptionIssue quantityProduct MaterialGroup
2PR111000Article 135PR1115
3PR112000Article 245PR1116
4PR113000Article 360PR1117
5PR114000Article 40PR1218
6PR115000Article 5120PR1219
7PR122000Article 680
8PR126000Article 7100
9PR127000Article 870
10PR129000Article 955
11Article MaterialquantityGroup
1210002015
1310001515
1410004017
1520008018
1630002017
1720006017
1850005015
1950007015
2020004515
2130006015
22600010018
2370007018
2490005518
25200015019
26200025020
2720003021
Sheet1
Cell Formulas
RangeFormula
B3:B6B3=B2+1000
D2:D10D2=SUM(IF($H$12:$H$27=VLOOKUP(A2,$F$2:$G$6,2,0),IF($F$12:$F$27=B2,$G$12:$G$27)))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Just to clear, can you please provide the actual expected results based on your sample data?
 
Upvote 0
It looks like this is probably what you want. If not, please provide the actual expected results based on your sample data.

sysuserwindows.xlsm
ABCDEFGH
1Product MaterialArticle MaterialdescriptionIssue quantityProduct MaterialGroup
2PR111000Article 175PR1115
3PR112000Article 2105PR1116
4PR113000Article 380PR1117
5PR114000Article 40PR1218
6PR115000Article 5120PR1219
7PR122000Article 6230
8PR126000Article 7100
9PR127000Article 870
10PR129000Article 955
11Article MaterialquantityGroup
1210002015
1310001515
1410004017
1520008018
1630002017
1720006017
1850005015
1950007015
2020004515
2130006015
22600010018
2370007018
2490005518
25200015019
26200025020
2720003021
Sheet3
Cell Formulas
RangeFormula
B3:B6B3=B2+1000
D2:D10D2=SUM(IF(ISNUMBER(MATCH($H$12:$H$27,IF($F$2:$F$6=A2,$G$2:$G$6),0)),IF($F$12:$F$27=B2,$G$12:$G$27)))
Press CTRL+SHIFT+ENTER to enter array formulas.


Does this help?
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top