Is there a way of putting two pivot tables together? - excel

So I've got two tables - one that hold premium data for insureds and one that holds claims data for insureds.
The commonality between them is a Deal number (D #).
On the premium table each Deal may have several layers though, so you could have Deal 1234 Layer 1 as this table shows (note deal # 11517 which has two layers):
D # Layer Annual Premium
3414 1 $320,000
9742 1 $632,454
16126 1 $675,000
21795 1 $2,100,000
5233 1 $165,756
5849 3 $611,538
23785 1 $1,770,833
11517 1 $840,000
11517 2 $135,400 *****
Then you have the claims table which looks like this (note deal 11517 is only listed once, but it's very possible for each deal to have multiple claims - see: 16535):
Deal Yr D# Paid Indemnity Paid Expense Incurred
2007 16535 $2,375,000 $162,634 $2,537,634
2007 16535 $7,125,000 $- $7,125,000
2006 10194 $3,839,575 $66,967 $3,906,541
2006 11517 $685,940 $124,139 $810,079
2006 13465 $2,126,242 $- $2,126,242
2006 11412 $10,000,000 $15,709 $10,015,709
2006 12313 $85,525 $- $85,525
2006 13688 $6,216,817 $100,576 $6,317,393
2006 13942 $236,669 $17,317 $253,986
So the question is, how do I put these table together without duplication. I've tried doing a vlookup on deal # but I end up getting duplicate claims figures for deals with multiple layers, or I get multiple premium figures if I go the other way.
I've tried making a premium table pivot to get a rolled up premium per deal # and a claims pivot to get a rolled up claims figure for deal #, but I don't know how to get them both on the same sheet... any thoughts?

Try this. Copy and paste your Claims table and then go choose Remove Duplicates under the Data tab. Choose the D# column only. This will give you a table with unique deal numbers.
Now delete the other columns and replace them with SUMIFS formulas. E.g.
=SUMIFS(Claims[Paid Indemnity],Claims[D '#],[#[D '#]])
=SUMIFS(Claims[Paid Expense],Claims[D '#],[#[D '#]])
=SUMIFS(Claims[Incurred],Claims[D '#],[#[D '#]])
Add one more column for the Annual Premium and use the appropriate formula:
=SUMIFS(Premiums[Annual Premium],Premiums[D '#],[D '#])
If you want to connect these tables and use them in pivot tables, then create a table with just the unique deal numbers and then load all three tables into your data model and create relationships like this:

Related

Select values from table based on order preference and availability - Excel 2016

I have the following table:
These are the order preference of some people based on the position (each column is a position).
In another page I have the availability of those people to fit that positions:
I would like to extract a determined number of people (Example: 2xF, 2xP, 1xPS, 4xR, 5xS, 1xWS, 2xDM) based on their availability and order but considering that they cannot fit two positions neither.
This is what I tried for DM (Very inefficient and not considering that they cannot fit two roles at the same time):
Formula: =IF(VLOOKUP('Pivot Puestos'!R3,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R3,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R4,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R4,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R5,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R5,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R6,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R6,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R7,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R7,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R8,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R8,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R9,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R9,Apto!A:B,1,0),IF(VLOOKUP('Pivot Puestos'!R10,Apto!A:B,2,0),VLOOKUP('Pivot Puestos'!R10,Apto!A:B,1,0),"No Disponible"))))))))

Creating a process to filter Specific Data via Rows and Columns in Excel

I'm trying to help a colleague with some work in Excel, he has a data-set of 40 Organisations of which each organisation has multiple Key Personal (KP). For each of these KP there has been an assessment against 3 key areas of criteria (where they are given a Y or N), these criterion being:
Geographic Area (Broken down into 26 Geographic Areas)
Industry Experience (Broken down into 18 Industries)
Areas of Expertise (Broken down into 18 Areas)
An example of the data is shown in the screenshot is linked
What I am trying to achieve is set up a 'filter form' that will allow an individual to put in their requirements (e.g. Aged Care Experience, in All of the West Region) and be provided with an output of the organisations that fit this criteria.
I have attempted to achieve this via utilizing a Pivot table, but have had no luck due to the different criteria and the fact that each organisation has multiple KP.
Any assistance would be much appreciated as to whether this can actually be achieved in Excel and how it could be done. If it can't I was thinking whether an Access Database could be used.
Update:
Please see attached the example data extract as requested by donPablo
Data Extract
From discussions with my Colleague the best outcome for him would be to get the Supplier, The KP and the other Criteria (think of it as filtering to hide all the Organisations and KPs expect the ones that meet the criteria).
if this is not achievable I can imagine that having the name of the organisation and KP as the output (that meet the criteria) would be suffice.
Think about maintenance of the ExampleData...
Adding a new Industry. Adding a new Expertise.
Splitting Industry into 3 Industry-s
Adding new Org with 2 KP
Deleting old KP3 from an org
For now with the initial concept, changes are small.
But soon in growth period there will be many changes.
How do you distribute these changes to all the users?
Thus, some sort of Split solution is needed.
A back-end DB (XLS or MSACCESS or SQLSERVER) ,
and a front-end form for--
Selection(s)
Results
Back-end as XLS could still be as ExampleData...
To be kept in central office.
And a front-end that links or references that db
but does not contain all the detail rows.
I think that the main matrix needs another column
called AreaType, value G or I or E
and that the area heading row needs to say
'ANY Geo" and have all "Y"-s in each column, etc for I and E.
In searching the matrix for Aged Care we should only look at Industry.
The ANY row would be chosen when the user does not choose an area.
I think that "Org" is a separate table
And that "KP" is another separate table.
This allows full details to be stored elsewhere
than the main matrix of areas.
Column heading of matrix would be "Org#~KP#", which would be
parsed on the tilde and separately looked up.
(it is improbable that any org or kp will have a tilde).
Yes, it is possible to search the matrix and retrieve qualified rows.
For ncol = minCol to maxCol
CountYInG = 0: CountYInI = 0: CountYInE = 0:
For each AreaType G, I, E
' then look at what was selected (gggg/iiii/eeee)
For each AreaName in (gggg/iiii/eeee)
If matrix = "Y" then add 1 to Count
next
next
if CountYInG > 0 and CountYInI > 0 and CountYInE > 0 then
This Org/KP qualifies
endif
next
added Pi Day, 20:00
First inclination is NOT to have 3 criteria tables (G/I/E), but rather ONE table.
Lets make several alternative DB designs. Then look at usage, and rank them.
Finally choose one and do it. Good luck, and Bye.
Matrix alternative
MatrixTable--AreaType & AreaName (PK), and one attribute Column for each Org/KP with value 'Y' or blank.
1st row has PK=C-ColHeadings, and each Column has Org#/KP# for that column.
OrgTable--Org# (PK), and OrgName, OrgStreet1, OrgStreet2, OrgCity/State/Zip, OrgPhone, ...
KPTable --KP# (PK), and KPName, KPOrg#, KPPhone
Normalized alternative (Admin would need to do pivot to see matrix view)
DetailTable--Org#(FK)-KP#(FK)-AreaType-AreaName(FK) DetailValue = 'Y' or ('Y' by implication of row existance)
OrgTable--Org# (PK), and OrgName, OrgStreet1, OrgStreet2, OrgCity/State/Zip, OrgPhone, ...
KPTable --KP# (PK), and KPName, KPOrg#, KPPhone
AreaTable--AreaType-AreaName(PK) (so that everyone spells it the same)
Your favorite design... list the tables, and their fields

Ranking text to see if they got a better health plan

I need to write code that will evaluate whether their plan change from the previous year and put "Moved Up" in a column to the right if the plan changed. First the code needs to make sure that they have the same member ID and that it is a new year. Here is what it looks like in excel:
000880093121 2015 Bronze 60 HMO
000880093121 2016 Silver HMO
My first thought was to use nested IF statements but I do not know how to tell excel that the Silver plan is a better plan than Bronze. There is a total of five different plans that members can have.
=IF(A3=A2,IF(B3>B2,"Moved Up"))
This will successfully compare the member ids and make sure that it is a new year. I just do not understand how to give text values a numeric value so that it can be compared. Also there is over 30k rows that I will be applying it to.
The output that I am looking for should be this:
000880093121 2015 Bronze 60 HMO -
000880093121 2016 Silver HMO Moved Up
Thanks for the help, much appreciated.
Put the different plans in a table sorted from "least-good" (top) to "best" (bottom), and name that range (e.g.) "planTable".
Then you can do this:
=IF(AND(A3=A2,B3>B2),
IF(MATCH(C3,plantable,0)>MATCH(C2,plantable,0),"Moved Up",""),
"")

Excel VBA: identify all possible combinations

I have two accounting records that i try to match.
Accounting record 1 contains the following (eg.) data:
A=100,
B=150 and
C=210.
Accounting record 2 contains the following (eg.) data:
x1=55,
x2=45,
x3=90,
x4=60,
x5=80,
x6=70,
x7=20 and
x8=40.
Mention should be made that data in both accounting records can be both negative and positive.
All the 3 transactions presented within Accounting record 1 is the sum of at least 1 transactions within accounting record 2. No doubling the transactions is to be considered.
Specifically, I need an excel vba code to get me the following results:
A=x1+x2;
B=x3+x4; and
C=x5+x6+x7+x8.
Since B can also be equal to x3+x7+x8, I need the code to loop through the possible solutions until all transactions within Accounting record 2 are allocated.
Any tips or recommended steps to take?
Many thanks!

Take 4 columns of identical data from 2 sheets with 2 columns of unique, sort by common

I've tried several VLookup strings and couldn't get it. Apologize in advance if this has been covered but spent hour and half looking/trying.
I have 2 inventory sheets. Columns 1-2 are identical on each (part #, Description). Column 3 has the inventory count for each period. I'd like to put them on one sheet with data lining up across rows. Problem is the #s aren't in same order on each sheet. Tried copy/paste and sort by Part#, then Part # but they don't match for some reason. Thank you so much. Chris.
Part # Description Count Part # Description Count
29169 SERIAL NUMBERL 300 50001E Impulse Finger 7,234
50010 Air Reject Bae 45 72000-S Chromax HD Ill 28
Name your value ranges as "Inventory1" and "Inventory2"
Go to Data>From Other Sources>From Microsoft Query
Then, select excel files, navigate to your workbook, and select both your ranges into the selection box.
Go into your Microsoft Query, and click the SQL button.
Select Inventory1.PartNum, Inventory1.Description, Inventory1.Count
FROM C:\$\Inventory1 C:\$\Inventory1
UNION ALL
Select Inventory2.PartNum, Inventory2.Description, Inventory2.Count
FROM C:\$\Inventory2 C:\$\Inventory2
Basically, this query will join your two ranges on top of each other based on the columns in the respective query (i.e: Partnum on Partnum).

Resources