Can SUMIF & SUMPRODUCT work together in a formula?

Gomesy

New Member
Joined
Oct 16, 2005
Messages
31
I have a very complex project that I am working on that involves looking up historical pricing. Here are my challenges:


  1. Identical products are found in multiple catalogs and sometimes at a different price.
  2. Since pricing within a particular catalog may change occasionally, there are pricing "valid from" and "valid to" dates.
  3. Most products have tiered pricing based on quantity breaks.

This is the nature of my project: A customer of mine has 30 hotels and has made over 5000 sales transactions during the past 12 months. During this time the customer was aligned with a GPO and received discounted pricing on all of their purchases. The customer is trying to validate their rationale for being affiliated with the GPO and is now asking how much would the properties have paid if they were not aligned with the GPO and received our "every day" pricing. In other words, what was their price based on their order quantity, catalog they selected and time of year in which their order was placed?

My file has two worksheet tabs. Tab 1 is named "All Sales History". Tab 2 is named "Catalog Pricing History". Here are the field "drivers":

All Sales History Tab



  • Column A - Order Date (date field)
  • Column B - Catalog Version (alpha-numeric field, i.e.: V66, V65, V14, H12, etc.)
  • Column C - Customer Number (numeric field)
  • Column L - Part # (unique numeric & alpha-numeric field)
  • Column N - Quantity Ordered (numeric field)
  • Column Q - Everyday Price Per Unit

Column Q is the field I need populated. Row 1 contains all Header information and all of the data begins on row 2.

Catalog Pricing History Tab



  • Column A - Valid From (date field)
  • Column B - Valid To (date field)
  • Column C - Part # (same as above)
  • Column F - Catalog Version (same as above)
  • Column G - Minimum Pricing Tier Quantity (numeric value)
  • Column H - Maximum Pricing Tier Quantity (numeric value representing the maximum amount you need to purchase in a price tier)
  • Column I - Price (numeric value based on you purchased)

I know how to use SUMIF to extract values based on criteria and criteria ranges. I know how to use SUMPRODUCT to extract values that fall within two ranges. I don't know how to "marry" them together.

Can someone write me a formula that can extract the price of a part # on a particular day, from a particular catalog and in a particular quantity please?

Thank you

Rick
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
A data sample for testing purposes (~10 rows) along with expected results would be helpful.

As a general idea i think SUMIFS can do what you need.

Maybe something like
=SUMIFS(History!I:I,History!A:A,"<="&A2,History!B:B,">="&A2,History!F:F,B2,History!C:C,L2,History!G:G,"<="&N2,History!H:H,">="&N2)

Hope this helps

M.
 
Upvote 0
A data sample for testing purposes (~10 rows) along with expected results would be helpful.

As a general idea i think SUMIFS can do what you need.

Maybe something like
=SUMIFS(History!I:I,History!A:A,"<="&A2,History!B:B,">="&A2,History!F:F,B2,History!C:C,L2,History!G:G,"<="&N2,History!H:H,">="&N2)

Hope this helps

Thank you Marcelo. Here are some test rows:

All Sales History Tab

Order Created onCatalog VersionCustomer #Customer NameAddressCitySTPostal Code 5 DigitPrice ConditionM-CATS-CATPart #DescriptionQuantityGPO Unit Price PaidGPO Extended Sell PricesEveryday Unit PriceEveryday Extended Sell Prices
03/18/16V66Catalog PricePlumbingShower Doors, Tubs & Enclosures680085Seasons Westwind Eng Stn Wall Soap Dsh8$24.99$199.92$0.00$0.00
05/18/16V66Catalog PricePlumbingWater Supply & Fittings54632612 SS Faucet Supply Pkg Of 1011$28.89$317.79$0.00$0.00
06/22/16V66Catalog PriceApplianceRefrigerators550131Seasons 2.4 Cu Ft Rfrgrator ESTAR Black2$144.43$288.86$0.00$0.00
07/18/16V66Catalog PricePlumbingSpecialty & Commercial Faucets500270AS Chrm Single Pedal Valve Floor Mnt1$110.33$110.33$0.00$0.00
07/18/16V66Catalog PricePlumbingStems & Cartridges515034Moen Tub/Shower Posi-Temp Ctg Plstc2$60.49$120.98$0.00$0.00
07/19/16V66Catalog PricePlumbingPipe Repair & Weatherization109113BlackSwan Plumbers Putty 14 Oz1$2.09$2.09$0.00$0.00
07/19/16V66Catalog PricePlumbingPop Ups & Repair515520Unvrsl SmPlstcw/S/STop P/U Plg 5"L pk/52$10.49$20.98$0.00$0.00
07/19/16V66Catalog PricePlumbingToilet & Tank Repair565110Sloan Flushmate® PressreAssist Retrofit1$139.00$139.00$0.00$0.00
07/19/16V66Catalog PricePlumbingToilet & Tank Repair583305Sloan Flushmate Cartridge C-100500-K3$31.49$94.47$0.00$0.00
07/21/16V66Catalog PricePlumbingLavatory Faucets405388Seasons Westwind Chrm 1Hndl Bth Fct1$73.99$73.99$0.00$0.00
07/21/16V66Catalog PriceJanitorial/CleaningCleaning Chemicals735101GymWipes Anti-Bacterial Disinfctnt Wipes1$59.51$59.51$0.00$0.00
07/22/16V66Catalog PriceFloor/Window CoverinWindow Covering Accessories7642833/8x36" Wht Fiberglass Baton Rod W/ Adp18$8.97$161.46$0.00$0.00
07/22/16V66Catalog PriceFloor/Window CoverinWindow Covering Accessories810527Unvrsl Baton Adapter Ring 10/Pkg5$4.67$23.35$0.00$0.00
07/22/16V66Agreement PriceLightingBatteries & Flashlights157755Duracell Procell AA Alk Battery 24/Pkg1$5.70$5.70$0.00$0.00
07/22/16V66Agreement PriceLightingFluorescent Tubes321432FLR Bulb Phl 25W T8 3500K 85CRI 30pk1$101.43$101.43$0.00$0.00
07/22/16V66Catalog PriceHardwareDoor Hinges & Closers8936804-1/2" Spng Door Hinge Br10$12.55$125.50$0.00$0.00
07/22/16V66Catalog PriceHVACTools & Supplies150605Hydro Balance Power Pac Aerosol Cleaner18$6.78$122.04$0.00$0.00
07/22/16V66Catalog PriceLightingEmergency Lighting Fixtures310800Red/Grn Led Exit Sign Battery Backup2$70.58$141.16$0.00$0.00
07/22/16V66Catalog PriceLightingFluorescent Tubes311776FLR Bulb Syl 32W T8 4100K 82CRI 30pk1$114.51$114.51$0.00$0.00
07/22/16V14Catalog PricePlumbingDecorative Bath Hardware818222Moen Double SN Robe Hook5$4.73$23.65$0.00$0.00
07/22/16V66Catalog PricePlumbingToilet & Tank Repair400446Kohler Tank Bolt Kit GP520502$9.29$18.58$0.00$0.00
07/22/16V66Catalog PricePlumbingToilet & Tank Repair565119Sloan Flushmate 503 Tank M-101526-F312$129.27$258.54$0.00$0.00
07/22/16V66Agreement PriceJanitorial/CleaningPaper Product117270Scott Jumbo Roll Bath Tissue 12/Cs2$39.95$79.90$0.00$0.00
07/22/16V14Catalog PriceJanitorial/CleaningHand Soaps & Sanitizers1171371 Gallon GOJO Antbac Hand Soap2$10.99$21.98$0.00$0.00
07/22/16V66Catalog PriceFloor/Window CoverinCeiling Tile807297Armstrong 2 X 4' Ceiling Tl 9767 10/Ctn4$86.48$345.92$0.00$0.00
07/22/16V14Catalog PriceJanitorial/CleaningCarpet Extractors & Floor Machines13074120 In Blue Floor Pad Package Of 21$46.49$46.49$0.00$0.00

Catalog Pricing History Tab

Valid FromValid ToPart #DescriptionBase UnitCatalog VersionMin QTYMax QTYPrice
03/19/1603/17/17109113BlackSwan Plumbers Putty 14 OzEachV66121,000$2.39
2/18/20172/18/20181171371 Gallon GOJO Antbac Hand SoapEachV1511,000$13.99
3/18/20173/18/20181171371 Gallon GOJO Antbac Hand SoapEachV6711,000$13.99
3/18/20174/8/20181171371 Gallon GOJO Antbac Hand SoapEachH1213$13.99
02/20/1602/17/171171371 Gallon GOJO Antbac Hand SoapEachV1441,000$12.99
03/19/1603/17/171171371 Gallon GOJO Antbac Hand SoapEachH1141,000$12.99
03/19/1603/17/171171371 Gallon GOJO Antbac Hand SoapEachV6641,000$12.99
2/18/20172/18/20181171371 Gallon GOJO Antbac Hand SoapEachV1541,000$11.99
3/18/20173/18/20181171371 Gallon GOJO Antbac Hand SoapEachV6741,000$11.99
3/18/20174/8/20181171371 Gallon GOJO Antbac Hand SoapEachH1241,000$11.99
03/19/1603/17/17117270Scott Jumbo Roll Bath Tissue 12/CsCaseV6631,000$55.95
02/20/1602/17/1713074120 In Blue Floor Pad Package Of 2PackageV1441,000$54.99
03/19/1603/17/1713074120 In Blue Floor Pad Package Of 2PackageH1141,000$54.99
03/19/1603/17/1713074120 In Blue Floor Pad Package Of 2PackageV6641,000$54.99
3/18/20173/18/2018150605Hydro Balance Power Pac Aerosol CleanerEachV67111$8.29
03/19/1603/17/17150605Hydro Balance Power Pac Aerosol CleanerEachV66121,000$7.74
3/18/20173/18/2018150605Hydro Balance Power Pac Aerosol CleanerEachV67121,000$7.29
2/18/20172/18/2018157755Duracell Procell AA Alk Battery 24/PkgPackageV1511,000$13.92
3/18/20173/18/2018157755Duracell Procell AA Alk Battery 24/PkgPackageV6711,000$13.92
3/18/20174/8/2018157755Duracell Procell AA Alk Battery 24/PkgPackageH12111$13.92
02/20/1602/17/17157755Duracell Procell AA Alk Battery 24/PkgPackageV14121,000$14.25
03/19/1603/17/17157755Duracell Procell AA Alk Battery 24/PkgPackageH11121,000$14.25
03/19/1603/17/17157755Duracell Procell AA Alk Battery 24/PkgPackageV66121,000$14.25
2/18/20172/18/2018157755Duracell Procell AA Alk Battery 24/PkgPackageV15121,000$12.48
3/18/20173/18/2018157755Duracell Procell AA Alk Battery 24/PkgPackageV67121,000$12.48
3/18/20174/8/2018157755Duracell Procell AA Alk Battery 24/PkgPackageH12121,000$12.48
03/19/1603/17/17310800Red/Grn Led Exit Sign Battery BackupEachV6615$75.89
03/19/1603/17/17310800Red/Grn Led Exit Sign Battery BackupEachV6661,000$84.36
03/19/1603/17/17310800Red/Grn Led Exit Sign Battery BackupEachV66121,000$93.75
3/18/20173/18/2018311776FLR Bulb Syl 32W T8 4100K 82CRI 30pkPackageV6713$145.63
03/19/1603/17/17311776FLR Bulb Syl 32W T8 4100K 82CRI 30pkPackageV6641,000$145.63
3/18/20173/18/2018311776FLR Bulb Syl 32W T8 4100K 82CRI 30pkPackageV6741,000$123.13
3/18/20173/18/2018321432FLR Bulb Phl 25W T8 3500K 85CRI 30pkPackageV6713$165.13
03/19/1603/17/17321432FLR Bulb Phl 25W T8 3500K 85CRI 30pkPackageV6641,000$165.13
3/18/20173/18/2018321432FLR Bulb Phl 25W T8 3500K 85CRI 30pkPackageV6741,000$141.13
03/19/1603/17/17400446Kohler Tank Bolt Kit GP52050EachV66121,000$10.99
03/19/1603/17/17405388Seasons Westwind Chrm 1Hndl Bth FctEachV6681,000$81.39
01/13/1703/17/17491332Raio - Face And Body Bar Case Of 500CaseV6711,000$203.99
01/13/1703/17/17491333Raio - Shampoo Bottle Case Of 144CaseV6711,000$89.99
01/13/1703/17/17491334Raio - Conditioner Bottle Case Of 144CaseV6711,000$89.99
01/13/1703/17/17491337Raio- Lotion Tube Case Of 144CaseV6711,000$91.99
03/19/1603/17/17500270AS Chrm Single Pedal Valve Floor MntEachV6681,000$130.00
03/19/1603/17/17515034Moen Tub/Shower Posi-Temp Ctg PlstcEachV6611,000$60.49
03/19/1603/17/17515520Unvrsl SmPlstcw/S/STop P/U Plg 5"L pk/5PackageV66101,000$11.59
03/19/1603/17/1754632612 SS Faucet Supply Pkg Of 10PackageV6611,000$29.94
02/18/1705/04/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV1511,000$161.00
03/18/1703/26/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6711,000$161.00
3/27/20173/18/2018550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6711,000$99.95
5/5/20172/18/2018550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV1514$99.95
02/20/1602/17/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV1451,000$195.00
06/18/1607/25/16550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6651,000$163.48
07/26/1608/07/16550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6651,000$179.00
08/08/1609/15/16550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6651,000$170.00
09/16/1601/29/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6651,000$170.00
01/30/1703/17/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6651,000$195.00
02/18/1705/04/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV1551,000$170.00
03/18/1703/26/17550131Seasons 2.4 Cu Ft Rfrgrator ESTAR BlackEachV6751,000$170.00
03/19/1603/17/17565110Sloan Flushmate® PressreAssist RetrofitEachV66121,000$149.00
3/18/20173/18/2018565119Sloan Flushmate 503 Tank M-101526-F31EachV67111$149.00
03/19/1603/17/17565119Sloan Flushmate 503 Tank M-101526-F31EachV66121,000$149.00
3/18/20173/18/2018565119Sloan Flushmate 503 Tank M-101526-F31EachV67121,000$139.00
02/20/1602/17/17583305Sloan Flushmate Cartridge C-100500-KEachV14121,000$34.49
03/19/1603/17/17583305Sloan Flushmate Cartridge C-100500-KEachV66121,000$34.49
03/19/1603/17/17680085Seasons Westwind Eng Stn Wall Soap DshEachV6611,000$27.99
03/19/1603/17/17735101GymWipes Anti-Bacterial Disinfctnt WipesEachV6641,000$68.99
02/20/1602/17/177642833/8x36" Wht Fiberglass Baton Rod W/ AdpEachV14101,000$10.59
03/19/1603/17/177642833/8x36" Wht Fiberglass Baton Rod W/ AdpEachH11101,000$10.59
03/19/1603/17/177642833/8x36" Wht Fiberglass Baton Rod W/ AdpEachV66101,000$10.59
03/19/1603/17/17807297Armstrong 2 X 4' Ceiling Tl 9767 10/CtnCartonH1151,000$102.00
03/19/1603/17/17807297Armstrong 2 X 4' Ceiling Tl 9767 10/CtnCartonV6651,000$102.00
03/19/1603/17/17810527Unvrsl Baton Adapter Ring 10/PkgPackageV66101,000$5.49
02/20/1602/17/17818222Moen Double SN Robe HookEachV14101,000$5.59
03/19/1603/17/17818222Moen Double SN Robe HookEachV66101,000$5.59
03/19/1603/17/178936804-1/2" Spng Door Hinge BrEachV66201,000$14.49

<colgroup><col><col><col><col><col span="3"><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col span="3"></colgroup><tbody>
</tbody>

All of the prices being sought in the All Sales History tab are found in the Catalog Pricing tab examples I have provided.

Thank you,

Rick
 
Upvote 0
Have you tried the formula i suggested above?
Could you provide some (2 or 3) expected results and the logic?

M.
 
Upvote 0
What is the real name of your second sheet (Catalog)? Adjust the sheet name in my formula.

M.
 
Upvote 0
Uh-oh Marcelo. It seems the formula isn't working when the Quantity that was ordered on the "All Sales History" tab (Column N) is not found in Min QTY column of the "Catalog Pricing History" tab (Column G).

The logic needs to look between the range of Min QTY (Column N) and Max QTY (Column O) instead of just looking at the value of the Min QTY.

I saw on another site how the SUMPRODUCT formula is used to look between two ranges in two columns. Are you familiar with this formula and can you get it to work in this instance?
 
Upvote 0
Uh-oh Marcelo. It seems the formula isn't working when the Quantity that was ordered on the "All Sales History" tab (Column N) is not found in Min QTY column of the "Catalog Pricing History" tab (Column G).

The logic needs to look between the range of Min QTY (Column N) and Max QTY (Column O) instead of just looking at the value of the Min QTY.

I saw on another site how the SUMPRODUCT formula is used to look between two ranges in two columns. Are you familiar with this formula and can you get it to work in this instance?

Have you set the columns min/max properly?
Observe my formula (probably with the wrong sheet name)
=SUMIFS(History!I:I,History!A:A,"<="&A2,History!B:B,">="&A2,History!F:F,B2,History!C:C,L2,History!G:G,"<="&N2,History!H:H,">="&N2)

M.
 
Upvote 0
The logic needs to look between the range of Min QTY (Column N) and Max QTY (Column O) instead of just looking at the value of the Min QTY.

Adjust the sheet name and correct the columns in my formula to
=SUMIFS(History!I:I,History!A:A,"<="&A2,History!B:B,">="&A2,History!F:F,B2,History!C:C,L2,History!N:N,"<="&N2,History!O:O,">="&N2)

M.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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