SUMIF with two criterias: Sum within a given time frame and if a group of cells do match

Liberty Prime

New Member
Joined
Dec 18, 2017
Messages
18
Hi there ;)

I hope you can help me with the following thing I'm (unsuccessfully) dealing with.

I'm updating on a daily basis a report with a list of values based on a date, values which I want to sum for a given time frame, though only if they match certain criteria (with other words, the sum of all the expenses from day 1st of the month to for example the day 14th, attributed to the account A). The account will be always the same, but the time frame will be changing and the upper limit selected from a dropdown list (the minimum will be always the day 1 of the month). It seems like a SUMIF with two criterias, but a bit more complicated than usual.

For another report I have a different formula that may help in this case and I use to pull the values of a cell for an exact day. If I could add a SUMIF there it would be awesome. It seems as follows:

=INDEX('Input'!G:G,MATCH(A7&B7(DATE(YEAR('Input'!$B$2),MONTH(DATEVALUE('Input'!$B$2)),$C$2)),'Input'!A:A&'!B:B&'Input'!C:C,0)))


As a legend:

* Input!G:G is the column with the expenses
* A7&B7 the account to be checked
* Input!$B$2 contains the month, year and starting date of the range
* $C$2 is the cell with the day to be checked
* Input!C:C is the column containing the date

Thanks in advance!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Upvote 0
Hi Scott T,

thanks for the help.

The SUMPRODUCT does not work as its lacking a crosscheck among two different tabs and I can't make it work it I try to introduce this via = or MATCH.

And yes, the Google Spreadsheets I'm using do have the SUMIFS function, but again, I can't make them work. Here is what I have tried:

=SUMIFS('Input'!G:G,'Input'!A4:B750,A7&B7,'Input'!C4:C,'Input'!C4>='AdWords Input'!B2&'Input'!C4<=B2)

Input G:G is the column with the expenses
Input A:B are the columns with all the accounts
A7&B7 (from the output tab) are the exact accounts I want to be used as criteria for the sum
Input C:C is the column with all the dates
Lastly is the criteria of the date, that should be greater or equal to the first day of the month as also less or equal to the cell B2 (output tab), with the day to be checked.

I get the #VALUE error, but I have no clue what is wrong.

Best regards
 
Upvote 0
Hum... Not sure if I'm not explaining myself very clear. I hope this will make it easier. With other words, what I would like to achieve is:

Check in the TAB Nº2 (input) the columns A:A&B:B&C:C if any of their combined rows match the combined cells A2&B2&C2 from TAB Nº1 (output). If true, then within this TAB Nº2 sum all the values of the column G:G for these matching rows.
 
Upvote 0
You can put some examples of what you have on sheet1 and on sheet2. In this example mark in some color which match and how much would be the sum.
 
Upvote 0
I have never used google sheets. Hopefully someone familiar with google sheets can help you.
 
Upvote 0
After many attempts, I've finally found it :)


This is the cost per day: =INDEX('Input'!G:G,MATCH(A7&B7&(DATE(YEAR('Input'!$B$2),MONTH(DATEVALUE('Input'!$B$2)),$C$2)),'Input'!A:A&'Input'!B:B&'Input'!C:C,0))

This is the accumulated cost: =SUMIFS('Input'!G:G,'Input'!C:C,">="&MIN('Input'!C:C),'Input'!C:C,"<="&(DATE(YEAR('Input'!C:C),MONTH('Input'!C:C),$C$2)),'Input'!A:A,'Output'!A7,'Input'!B:B,'Output'!B7)


Maybe one last question. Instead of SUMIF and dividing by the amount of days to calculate the average cost per day, is there any AVERAGE formula to be used instead? Otherwise I won't complicate my life more than needed.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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