Summing a range of cells when date is found in a range of other cells

bozzy71

New Member
Joined
Mar 4, 2013
Messages
38
Office Version
  1. 365
Hi,

I have the following formula to search for a month and year in a cell, and then add the value from another cell =IF(TEXT(K6,"myy")="521",E6,"") - however, I'd like to search a range of cells (eg K6:k50 for the month of May) and return any figure as previous from the range of E6:E50 if May is found. Therefore if in K6 and K12 and K20 "may" is found, then the figure in E6, E12 and E20 are returned and added together and so on. Hope that makes sense!

thx
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How about
Excel Formula:
=SUMIFS(E6:E50,K6:K50,">=01/05/2021",K6:K50,"<=31/05/2021")
 
Upvote 0
Defining month and year as 521 is not really a formula friendly method. You could get around it with sumproduct as below but I would advise rethinking your approach to make use of @Fluff's method, or something similar.
Excel Formula:
=SUMPRODUCT(--(TEXT(K6:K50,"myy")="521"),E6:E50)
My personal (formula) preference is to use a combination of SUMIFS and EOMONTH with a proper date in cell on which to base the criteria.
 
Upvote 0

Forum statistics

Threads
1,214,886
Messages
6,122,093
Members
449,064
Latest member
Danger_SF

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