Creating a sum based on a category within a date range - excel

I'm trying to make a spreadsheet that I can easily take an export from Mint.com's CSV outputs and get them into my Excel budget.
To do so, I need a way to populate each field within a date range. I'd like to avoid macros if possible (I don't know how to make them).
I'm happy to share my finished .xls with the public!
I've imported Mint.com's data in a manner that has column S for the date (3/30), column V with the cash value that I need to add up, and column X for the spending category.
I need to tally each month's spending ($V) by category (column X).
Through research, I devised this (for my January "Gas & Fuel" spending):
=SUMIFS($W$2:$W$900, $T$2:$T$900, ">="&W$12, $T$2:$T$900, "<"&(EOMONTH(D$1,0)+1), $Y$2:$Y$900, "="&$B5)
However, it required that I reformat my Dates, which is an issue because this would become specific to each year and I would need to change the fields every year. I'd like the document to be usable without adjustment using my spending data from the past and future.
Is there a way to take the year out of the equation? To make that formula above work, I renamed my column from "January" to "1/14".
Here is what the spreadsheet looks like
Thanks!

A pivot table would work best with that data.
Initial set up would show each day separately, but by using Grouping
(here) ^^^
you can group the data by month/day/year/however

Related

Excel PivotTable create column based on summarised column data

I have the following Pivot Table:
I am trying to derive the number of cases created per resource for a given month. I.e. for Jan 2021 the formula would be 768/9 = 85.333...
I've tried to use a Calculated Field, but the issue I'm having is that the PivotTable uses the underlying data e.g. for a given case, create date is 1/1/2022 and the resources on that day is 8. It is then dividing the numeric value of 1/1/22 by 8 and coming up with a value in the thousands, for obvious reasons, and then working out the average/sum/etc for all of the cases within that month. What I need is a way of just doing B5/C5 but within the pivot table itself, rather than a column outside of the pivottable. Is this possible?
P.S. Sorry if this is a basic one that has already been answered, but I'm not always sure on the correct terminology for PivotTable functionality so I've likely been googling like a 6 year old.
Thanks,

Restructuring Excel Spreadsheet Data

I have an Excel spreadsheet with membership data, which includes each member’s coverage start date and coverage end date (if applicable) among many other data fields. I’m trying to restructure the data so that each month that the member’s coverage was effective is represented by a single row. For example, if a member has a coverage start date of 1/1/2019 and a coverage end date of 12/31/2019, the member’s information would be displayed 12 times. If the member has no coverage end date listed, then the number of rows listed for that member will be based on the number of months between the coverage start date and a date defined by the user.
To further complicate the issue, there are instances within the data that a member is displayed more than once due to changes in various coverage options so the total number of rows for a particular member will need to represent all months in which their coverage was in effect.
Any ideas/suggestions as to how to accomplish all of this?
The answer depends on your needs moving forwards. Changing the data to a per-month format and maintaining it that way is different than continuing to maintain the original data, and also needing to convert it to this new format. Consider that carefully when you choose how to do this. You might make things more difficult for yourself moving forwards.
In order to convert the data you currently have (which I assume is one line per member) to the data you want (one line per month per member) I would write a VBA script which would loop through the entire first sheet and do the steps to get it in the format I want. If you are not VBA saavy, you can do this with filters. The steps for manual filtering would be:
Find the earliest month you have (Let's say for this example that is January 2000), and filter your data for that month only.
Copy the filtered lines only to a new sheet. This is your January 2000 data.
At this point, you can either modify the lines you just copied so they indicate they are January 2000, or name the page January 2000, and keep each month on its own page.
Do the same for the next month. Continue until you have all of your data sorted by month.
At this point, you can modify and recombine the data, or leave it in separate sheets.
For a VBA solution, I would go line by line through the original data, and copy the line to each location in belongs in based on start/end dates. If separate sheets, I would pre-create all the sheets I need.
Good luck.

Pulling first/last values from a list

I have a data set of client sales over time. Few clients have the same date range, but I'm trying to create a chart that shows client-group growth over time.
My current thought is to number the months (1,2,3, etc) since the client began the program.
However, to do this I need a formula I can apply to a list several thousand clients long (and 10-15 dates per client) that will reset for each new client. Dates are in YYYY-MM format.
Any advice on how to create this? I'm stumped and it's 2AM. Also very open to alternatives.
Not a whole lot to go on here, but this sounds like it could be done in a pivot table. If you are trying to avoid a pivot table, you can try formulas countif or sumif to capture the client and count or sum whatever you are trying to capture. Your date, if it is in a text format, should be converted to an excel date, =date(value(left(G5,4)),value(right(G5,2)),1).

Calculate average based on a value column (count) in a pivot table

I'm looking a way to add an extra column in a pivot table that that averages the sum of the count for the months ("Count of records" column) within a time period that is selected (currently 2016 - one month, 2017 - full year, 2018 - 5 month). Every month would have the same number based on the year average, needs to be dynamically changing when selecting different period: full year or for example 4 months. I need the column within the pivot table, so it could be used for a future pivot chart.
I can't simply use average as all my records appear only once and I use Count to aggregate those numbers ("Count of records" column).
My current data looks like this:
The final result should look like this:
I assume that it somehow can be done with the help of "calculated filed" option but I couldn't make it work now.
Greatly appreciate any help!
Using the DataModel (built in to Excel 2013 and later) you can write really cool formulas inside PivotTables called Measures that can do this kind of thing. Take the example below:
As you can see, the Cust Count & Average field gives a count of transactions by month but also gives the average of those monthly readings for the subtotal lines (i.e. the 2017 Total and 2018 Total lines) using the below DAX formula:
=AVERAGEX(SUMMARIZE(Table1,[Customer (Month)],"x",COUNTA(Table1[Customer])),[x])
That just says "Summarize this table by count of the customer field by month, call the resulting summarization field 'x', and then give me the average of that field x".
Because DAX measures are executed within the context of the PivotTable, you get the count that you want for months, and you get the average that you want for the yearly subtotals.
Hard to explain, but demonstrates that DAX can certainly do this for you.
See my answer at the following link for an example of how to add data to the DataModel and how to subsequently write measures:
Using the Excel SMALL function with filtering criteria AND ignoring zeros
I also recommend grabbing yourself a book called Supercharge Excel when you learn to write DAX by Matt Allington, and perhaps even taking his awesome online course, because it covers this kind of thing very well, and will save you significant head-scratching compared to going it alone.

Filtering specific individual dates in PivotTables with changing input

How do I filter data for specific individual dates in a PivotTable? The input is changed on a weekly basis and therefore the specific desired dates will change every week. I have data for every business day. And I want to retrieve data from the most recent business day, 5 business days before that, 30 business days before that and 90 business days before that. How do I go about this?
Sound like you want an 'Aging Report' If you Google on 'Excel Aging Report', you should be able to find something. use of TODAY() in formula is part of answer. I also did something similar here. It didn't involve Pivot tables.. But it should help you on your way.
You might want to check out the code in my answer at Filtering pivot table with vba
That code lets you programatically filter a Pivot RowField or ColumnField by specifying an interval type (e.g. days, weeks, months, quarters, years) as well as an interval count (e.g. 7, -7). It has an optional argument vRelativeTo field which counts back/foward from the youngest/oldest item depending on whether lNumber is positive/negative.
It leverages off the inbuilt DateFilters functionality, and as such does not
work on RowFields.

Resources