Looking to sumif data from month 1 to N

SmileItOff

New Member
Joined
Jan 27, 2017
Messages
8
Hello Misters/Misses,

I'm trying to setup a table for some Year-to-Date data from a massive list. Would like to have a formula/vba that pulls different data and sum/count them from month 1 to N, in which N serves as an input. For example, user (my boss) input 4 as April, the table then pulls the data from month 1 to 4, and so on.

Please help.

Thank you!
Sm: )e
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi,

It would be helpful to help you if you provide a sample of the layout you're using.

May be something like this?


Book1
ABCDEFGHIJKLMNO
1Jan-2018Feb-2018Mar-2018Apr-2018May-2018Jun-2018Jul-2018Aug-2018Sep-2018Oct-2018Nov-2018Dec-2018Input4
2100200300400500600700800900100011001200Total1000
Sheet79
Cell Formulas
RangeFormula
O2=SUMPRODUCT((MONTH(A1:L1)<=O1)*(A2:L2))
 
Upvote 0
Hi,

It would be helpful to help you if you provide a sample of the layout you're using.

May be something like this?

ABCDEFGHIJKLMNO
1Jan-2018Feb-2018Mar-2018Apr-2018May-2018Jun-2018Jul-2018Aug-2018Sep-2018Oct-2018Nov-2018Dec-2018Input4
2100200300400500600700800900100011001200Total1000

<tbody>
</tbody>
Sheet79

Worksheet Formulas
CellFormula
O2=SUMPRODUCT((MONTH(A1:L1)<=O1)*(A2:L2))

<tbody>
</tbody>

<tbody>
</tbody>

Hello J,

Thank you! Let me provide you with an example to better explain my question:

PositionTime elapsedlocationDate closedMonth
Position 10-30location 14/2/20184
Position 230-61location 25/19/20185
Position 361-90location 31/28/20181
Position 461-90location 16/5/20186
Position 561-90location 52/15/20182

<tbody>
</tbody>

This is how my data look like. I'm looking for a formula or vba code that counts the number of appearances of each criteria from month 1 to N.

Like if I want to know how many positions were filled within 61-90 days from Month 1-3, it would return 2. Whereas if I want to know the same for month 1-6, it would return 3.

Thank you very much!
Sm: )e
 
Upvote 0
Thanks for posting sample data.

If you have the COUNTIFS function:


Book1
ABCDEFGHI
1PositionTime elapsedlocationDate closedMonthCriteriaTo MonthResult
2Position 10-30location 14/2/2018461-9032
3Position 230-61location 25/19/2018530-6140
4Position 361-90location 31/28/2018161-9063
5Position 461-90location 16/5/201860-3051
6Position 561-90location 52/15/20182
Sheet84
Cell Formulas
RangeFormula
I2=COUNTIFS(B$2:B$6,G2,E$2:E$6,"<="&H2)


Enter your criterion in G and H, I formula copied down.
 
Last edited:
Upvote 0
Thank you very much! It worked! This is way more comprehensive than I thought. I was thinking about something like factorial in mathematics to solve this problem LOL
Mind if I ask, why it needs an & sign in between "<=" and the referencing cell?

Thank you!!
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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