Excel 2010 Pivot Table - Convert Text into Data - excel

I have 2 worksheets that I need to create 2 different pivot tables for.
On the first worksheet (Injuries) I need the data to be sorted by Department (FSD or Dist), which is marked by placing an "X" in the correct category.
I then need columns that quantify which type of injury it was, for example "Record Only", "Lost Time", etc. and know how many lost days there are for each department.
I'm stumped on how to change the marked categories into actual numerical data in the table.
On the second table, "Motor Vehicle Accidents", I again need the data sorted between department, which is marked with an "X".
I then need to know which type of accident it was, for example "Preventable" or "Parked".

Make a Column that maps that for you. For example, for the first Sheet, you can make a column and put the following formula on the cell:
=IF(D46<>"";"FSD";"DST")
For the second, it will be the same principle:
=IF(G85<>"";"PREVENTABLE";IF(H85<>"";"NON PREVENTABLE;IF(I85<>"";"PARKED";"1-800 MOR")))
Hope it helps.

Related

VLOOKUP to bring data from another sheet

I have a table containing a some football data, such as Country, League, Teams, Standing table information, such as total matches played, wins, draws, losses, goals scored and conceded, and so on.
Here's a file download link
It contains two sheets.
First sheet is STANDINGS_EXTENDED:
I need to fill these 3 tables with the data contained in another STANDINGS worksheet.
Here's a screenshot of the STANDINGS sheet:
My aim is that once I fill LeagueId and Group Id (which is optional) fields then inside all three tables will be produced the data as in this sample.
I wonder if it is possible to achieve this without VBA. But i have no clue on where to start from. I tried is several different ways, but i get only first result from STANDINGS worksheet for any league i enter.
Looking forward to your help.
Thank you!
UPDATE:
So far I could get the count of rows related to Overall, Home and Away using these formulas:
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!E1;STANDINGS!F:F;"StandingsOverall")
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!$E$1;STANDINGS!F:F;"StandingsHome")
=COUNTIFS(STANDINGS!E:E;STANDINGS_EXTENDED!$E$1;STANDINGS!F:F;"StandingsAway")
Also, what I can get is the first row of these results using this formula:
=VLOOKUP($E$1;STANDINGS!$E:$V;4;FALSE)
What I need to figure out is how to modify above formulas so that I fill tables with remaining rows.
In order to do this you need a formula in every single field of your 3 tables that link it to data on the Standings tab. That would be 13 x 3 x 20 formulas. Therefore one would try to create formulas that can be copied, in the best case less than 13 original ones, but definitely one formula for each field.
Each formula would look for a unique identifier in the Standings list. I can't see any unique identifiers there but you might create them by concatenation, such as "League" + "Country" + "Position". The more detail you need the larger the formula. The key is: without a unique identifier for each row you can't retrieve data. But once a row has been identified you can get the value from any of its columns.
If your tables sometimes have 12 rows, sometimes 20, and sometimes 25 you must provide space for the possible maximum and then design your formulas to return a blank if there is nothing to display.
In conclusion, the core of your system is in the Standings table. It must be set up so that data can be retrieved from it. Ideally, your selection on the Standings Extended sheet would generate a concatenated unique identifier for a list to which you can add the fixed number in the Pos column to identify individual rows in the Standing table. As long as you can't identify rows no data can be retrieved.
Using VBA gives you more flexibility but doesn't relieve you of the task to create uniquely identifiable rows.

Two way lookup within a sortable/filterable Excel table

I am looking to return the intersection of a given row and column in an Excel table, where the sort/filter of the table will be changed.
I have found lots of resources on how to do a two way lookup in a static Excel 2D array/table that will never change order, but I am running into trouble trying to reference these intersections of a given row and column in a table that will be filtered and sorted by users. Filters and sorts are changing the cells' locations, breaking my references.
Ideally, the solution should look something like this:
=INDEX(TABLE,MATCH("PRODUCT",A:A,0),MATCH("COMPANY",$1:$1,0))
or, something like this,
=TABLE[[#Data],[PRODUCT] TABLE[[#All],[COMPANY]]
My environment is a table where the left most column is a list of products, and the top most row are column headers listing company names. The cell values at the intersection are quantities of products per company.
Thank you for any help, in advance!!
EDIT: Here's a visual example,
PRODUCTS COMPANY A COMPANY B
PRODUCT #1 1 2
PRODUCT #2 3 1
Referencing "COMPANY B", "PRODUCT #1" would return 2-- what's key is that the reference isn't broken by the table being filtered or sorted.
The first formula works, if made to select adjacent cell.
=INDEX(TABLE,MATCH("PRODUCT",A:A,0)-1,MATCH("COMPANY",$1:$1,0))
Revisiting later, it was selecting cell underneath the intended. Weird. Not positive why, but seems no one really took a look here. Folks at /r/Excel understood, though without any ideas as to why it picks cell below intended.

Excel Pivot - spanning field name across all relevant columns

I have a table of employees with their work location (state initials) and their work status (FMLA leave, part time, full time). I've made a pivot table so that I can see the number of employees in each state relative to their status. Making the pivot table is easy, and it looks like this:
My question relates to the column field name cell (highlighted in red). When the table is first created, Excel auto fits the columns. However, if you look at the picture, it is clear that ideally the FMLA, FT, and PT, columns should all be the same size for the table to look good. I can resize the columns, of course, and set the table to not auto size when it refreshes.
When I resize the columns the table now looks like this:
Two problems with the new layout. First, it is not clear at all that the "Employee Status" field name applies to all three columns FMLA, FT, PT. Second, with the first column being narrower "Employee Status" no longer fits. In Excel 2013, the field name is limited to just its column. In Excel 2016 it spills over to the next column, but has the filter pulldown in the middle of it! And of course the formatting doesn't spill over.
In a non-pivot, I would "merge" the three cells above the column headings and make "Employee Status" span all three cells. Leading to a much more intuitive look. However, "merge" cannot be used in pivot tables. My only work around at the moment is to Hide the row with the field name, and put a new row above it that is not part of the pivot table. Ends up looking good, but of course, it will not dynamically adjust if a new value is added to "Employee Status".
I'm looking for other recommendations on how to format this table so it ends up looking like this:
Ideally solution will work with Excel 2013, which unfortunately is what I'm limited to.

Calculate average of values in a column based on matches of two variables in two other columns

I'm having an issue with some data that I'm working on that has had me stuck for a while.
I'm working on some patient data for a clinical practice that has each patient encounter logged on a separate line with an account ID, date of service, the height and weight measurements for that date, and other variables.
Aside from VLOOKUP and the usual formulae/functions I've got a pretty rudimentary understanding of Excel but I can pick up on things fairly quickly.
In the data I've got each line tied to a patient account ID as well as what quarter the DOS was in. For patients with multiple visits, they will be identifiable by repetitions of the account ID number on other lines.
For some patients, there will also be repetitions in the quarter if the same patient was seen twice in the same quarter. This is where I need help.
I'd simply like to average the value of a variable for each patient in each quarter. I'm not sure if AVERAGEIFS is the right function to use but I need an operation that checks for matches in a line of both account ID and quarter (Q1, Q2, Q3, or Q4) with the other lines in the sheet and comes up with a quarterly average for the variables in question.
What I have
What I need
If I'm understanding your question, you could use AVERAGEIFS to accomplish what you are asking. With excel, a lot of how successful an approach will be is determined by how your data is structured, and if/how often you are planning on updating your work.
It would be easier to give a concrete answer with an example of the data you are looking at.
If your source data is in columns A:D something like:
and you are looking to summarize the weight data in I by account ID and Quarter:
you could use AVERAGEIFS(C:C,A:A,G2,B:B,H2) this would find the cells in column A that match the value in G2, find the cells in column B that match the value in H2, and report the mean value in column C of the matching rows.
An alternative is to use a pivot table, which automates a lot of what you are trying to do. For that approach you would select your data block, and click on Insert>>Insert Pivot Table (at least in my version). That should bring up a wizard. Accepting the defaults will create a new sheet. Then look on the right side of your window, and you should see a list of your column names near the top, and four boxes called Filters, Columns, Rows, and Values. You should be able to drag and drop your columns into these boxes to get summaries of your data. If you add your Account ID and Quarter tabs as columns, and your height and weight as Values, then right click on each of the value columns and select "Value Field Settings" and select Average from the menu that pops up. That should give you something that looks like:
At that point, you can change the formatting to make if fit your needs, or copy data somewhere else.
The AVERAGEIFS approach will automatically update if you add more data, but will only summarize things that match the values you list. If there is an account ID/Quarter pair that isn't in the summary column you won't have any idea it's there. If you are summarizing an ID/Quarter pair that isn't in your data you'll end up with a division by Zero error like in the example.
The Pivot Table option only updates when you manually click refresh (right click and choose refresh pivot table from the menu), but will summarize all the data based on the columns you've selected. It's also a little more robust as you avoid having to type out the formulas and make sure you are pointing to the right column. This option also by default provides nested summaries; you can turn the subtotals and grand totals off if you want.
I used the function:
=SUMPRODUCT(($B$2:$B$13="Customer 1")*($C$2:$C$13="Q1"))
Where Customer 1 could be a user id and Q1 you can change to which quarter you want.
Excel screenshot

Custom column in Excel pivot table

I am using a pivot table to display data. In the pivot table I have countries and under each country couple of names. Then how many training a person led and how big attendance there was.
I have two questions:
1) In the data source, I created additional column where is displayed the last training date (latest date) for every person. Meaning that in the source data, in every row for one person, there is always the same "Last training date". I would like to take this information a show it in the pivot table. But anywhere I put it, it's always used as another filter and it makes the table much more complex. I would like to have just a custom column with this info without having to expand the whole table. It's the last column in the example image.
2) Same applies for the attendance. If the training has been cancelled, the attendance is always 0. Is there a way to hide the whole column? Same for the total of attendance. I don't really need these columns.
Try This:
First question:
In the main table change the [Date Field] to type Number
Put the [Data Field] in values into the pivot table
Select any value where is the column [Date Field] and right click:
Go to Summarize values by select Max
Again right click. Go to Number Format...
Select the date format what you like
Second question:
I would like to see a data's sample. It could be fake. I have some ideas but is difficult to see just guessing...

Resources