How to make If, Sumif Function Formula shorter

Hmerman

Board Regular
Joined
Oct 2, 2016
Messages
102
Hello,
I have a formula on one Sheet that looks in row B4:Q4 on another Sheet, for the cell If it equals the string "KG" then it Sumifs that Range of Rows 5:1000 for the criteria range in A5:A1000 and criteria in A2:
e.g. If H4 = "KG" then Sumifs range:A5:A1000 criteria: A2 sum_range: H5:H1000

The formula works, but it is a very long formula:
=IF('Paul Verdeling'!B4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!B5:B1000),IF('Paul Verdeling'!C4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!C5:C1000),IF('Paul Verdeling'!D4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!D5:D1000),IF('Paul Verdeling'!E4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!E5:E1000),IF('Paul Verdeling'!F4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!F5:F1000),IF('Paul Verdeling'!G4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!G5:G1000),IF('Paul Verdeling'!H4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!H5:H1000),IF('Paul Verdeling'!I4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!I5:I1000),IF('Paul Verdeling'!J4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!J5:J1000),IF('Paul Verdeling'!K4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!K5:K1000),IF('Paul Verdeling'!L4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!L5:L1000),IF('Paul Verdeling'!M4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!M5:M1000),IF('Paul Verdeling'!N4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!N5:N1000),IF('Paul Verdeling'!O4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!O5:O1000),IF('Paul Verdeling'!P4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!P5:P1000),IF('Paul Verdeling'!Q4="KG",SUMIF('Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2,'Paul Verdeling'!Q5:Q1000),"GEEN KG"))))))))))))))))

Is there a way to make it shorter?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Looks like:

=SUMIFS(INDEX('Paul Verdeling'!B5:Q1000,0,MATCH("KG",'Paul Verdeling'!B4:Q4,0)),'Paul Verdeling'!A5:A1000,'Sundried Verdeling'!A2)
 
Upvote 0

Forum statistics

Threads
1,216,089
Messages
6,128,750
Members
449,466
Latest member
Peter Juhnke

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