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.
Related
I have a workbook containing several thousand records. Each day the raw data is refreshed by downloading a master file from a central system and saving over the existing file. I need to create something that will count the number of records that match a certain criteria (i.e. how many belong to my department) and store the number in a table each day, i.e. Monday X, Tuesday Y, Wednesday Z etc.
Many years ago a colleague developed a macro to do this by opening the source file and copying the source data into a new file, but it is also programmed to produce several other MI reports within the same macro that are no longer needed, the VBA code is extremely long and complex and the whole process takes around 2 hours each day.
I'm fairly new to Power Query, but I know I can import the data in seconds and use a simple Countif to tell me what I need to know, but obviously once the data refreshes the following day the value from the Countif will update too. Instead, I need to store the values of the previous days and weeks to retain the count in one cell and the newly refreshed value in another. It also needs to be something very simple that a complete beginner could update at the click of a button to automate the process.
Can anyone suggest the best way to do this? Thank you in advance
I have an Index Match Match question that I have not been able to find the answer for in researching. Although the solution may actually might be different than an Index Match Match formula - I'm open to try something more efficient than my current workaround.
I have one worksheet with data from my company on it. We sell a Product (let's call it Coke Zero) and we track the weeks that we put a promotion on and how much profit we make by selling it to the retailer. For example a promotion for Coke Zero starts the first week of Jan and ends 3 weeks later and we make a gross profit of $100 each week the promotion runs. I then have an external database with sales data formatted on a weekly basis to tell me how many units of Coke Zero I sold in each week. My internal data has thousands of lines like this with dozens of products, however the promotions are consolidated on one single row regardless of if it runs for more than one week, making matching up to the external database difficult. I need to create a lookup for what our Gross Profit was for each week of the promotion.
I have attached an example image of the workbook + two data sheets of what I've tried to do, summarised below.
On the Internal Data Sheet I've created additional columns to the right with all of the weeks listed that the promotion is on for, and concatenated them with the Product Code to be able to match week by week to the data in the External data sheet. Then my lookup basically checks every column one after another until it finds one where the concatenate of Week_Product Code concatenate matches.
My current solution technically works but my final formula is really slow and cumbersome given the data can be anywhere from 10K-200K lines when looking at multiple retailers. I was hoping to find a more efficient formula to complete the lookup.
Current solution on the External Data Sheet Column E:
=IF(ISNUMBER(MATCH(D2,'Internal Data'!$E:$E,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$E:$E,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$F:$F,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$F:$F,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$G:$G,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$G:$G,0)),
"0")))
I got SUMPRODUCT to work using this formula in J2:
=SUMPRODUCT(--($B$2:$D$3=H2)*--($E$2:$E$3=I2)*$F$2:$F$3)
And, you don't need those concatenated lookup columns:
Well, that was fun.
I have a student license of Office Pro 2016, but somehow it doesn't have the IFS, MINIF/MINIFS, MAXIF/MAXIFS functions that would make my life so much easier. I tried to illustrate what I'm doing in the image below:
Example
My actual data is much more complicated and long, but the idea is that I will periodically manually update data within the DATATABLE, and I want the SUMMARYTABLE to reflect the total pending sales by month. There are never more than two months pending at a time, and if only sales from one particular month are pending, I don't want the second row to appear.
I've already found a way to display the month in this case using regular MAX and MIN functions, but now I'm stumped as to how to display the sum total of sales within those months. Specifically, I don't know how to make a reference to a particular month in my criteria.
I've tried this formula:
=SUMIFS(DATATABLE[SALES],DATATABLE[SHOP]="A",DATATABLE[STATUS]="PENDING",MONTH(DATATABLE[DATE]),SHOPATOTALS[MONTH])
If this worked it would have been perfect, but the month portion isn't recognized as a proper range.
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
I have to report basically the same information from inspections to two different clients, both of whom have provided me with an Excel spreadsheet in their own preferred format, and password protected. I have put the two sheets into my own workbook, and have managed to get 'almost' all the data on both sheets to populate from my own data. Where I am stuck though is on the time logs.
Client 'A' has each time and date in a single column, in the format "12.29.12 14:30". Client 'B' has two columns, date as "12/29/12" in the first, and time as "1430" in the second.
I'm trying to avoid having to type all the same dates and times twice - it can be several dozen lines - both to save effort and to avoid errors. What I really need to do is either concatenate the date and time from client 'B's report and put it into client 'A's, or split the date and time up in 'A's so I can put it ito 'B's. I've tried several approaches, but just end up with error codes or meaningless numbers.
Can anyone point me in the right direction?
Thanks,
Richard
Never mind... the very next thing I tried worked :-)
To anyone else reading this, the trick is not to concatentate the date and time values, but to add them together.
Richard
As you later pointed out in your own question, in order to manipulate date/times in Excel, you should add instead of concatenating.
The reason for this is that Excel stores all date/times as a number representing the number of days since January 1, 1900*. This number is stored as a 8-byte double.
Use Excel number formats to display the date/time format that you desire.
If you find in a worksheet that some cell's dates are in fact stored as text, use the DATEVALUE function.
*By default, Excel 2010 for Windows uses the number of days since 1900. There is an option to use the number of days since 1904 for compatibility with other versions.