SUMIFS but only if value is less than another cell

Lancer7

New Member
Joined
Oct 16, 2022
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Hey everyone, I currently have a formula =SUMIFS(Contracts!J:J,Contracts!E:E,"Lg. Green Lentil",Contracts!N:N,"2021") It works well for summing numbers based off of criteria on another worksheet, BUT I want to add a couple things 1) A max that the number can be so the current formula is in cell F45 and the answer I'm getting back is 26,455, but in cell C45 I have a number 17,254, I want the formula to work as is unless the number is equal to or greater than the number in C45 then it just stays at the value in cell C45. And 2) If C45 is blank then it just works as it was before. First time posting I'm not great on excel but usually between forums or videos I can figure out something that works but this one I just can't seem to figure out
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Give this a try:
Excel Formula:
=IF(C45="",
           SUMIFS(Contracts!J:J,Contracts!E:E,"Lg. Green Lentil",Contracts!N:N,"2021"),
           MIN(SUMIFS(Contracts!J:J,Contracts!E:E,"Lg. Green Lentil",Contracts!N:N,"2021"),C45))

You can also use the LET command and make it something like:
VBA Code:
=LET(xsumif,SUMIFS(Contracts!J:J,Contracts!E:E,"Lg. Green Lentil",Contracts!N:N,"2021"),
          IF(C45="",xsumif,MIN(xsumif,C45)))
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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