Thanks in advance for your time and consideration.
I am familiar with the concept of the VLOOKUP function in excel and was hoping for a little assistance. I have multiple tables in excel and have used the VLOOKUP command with success to do things such as fill cells with the full name, address, etc of an business when our internal business code is input. My current problem is this.
I have coverage tables indicating insurer X covers company Y over a given date range. I have data indicating company Y made Z dollars in earnings over another given date range. These dates most often do not match up nicely. I want to a sum of the total earnings associated with each insurer.
For example, Company Y was covered by Insurer A from 01/01/1980 to 04/15/1980 and Insurer B from 04/16/1980 until 06/20/1981. Company Y earned $250.00 from 01/01/1980 to 03/31/1980 therefore that $250.00 was covered by Insurer A, $0.00 by Insurer B as the date range doesn't include any time covered by Insurer B. Company Y earned $1000.00 from 04/01/1980 to 12/31/1980, No income the next year. 15 Days were covered by Insurer A, 260 days covered by Insurer B. Therefore $54.55 ((15/275)*1000) covered by Insurer A, $945.45 ((260/275)*1000) by Insurer B. Summed up $304.55 Insurer A, $945.45 Insurer B.
How would I go about doing this? If this is something beyond the features of excel, what would you recommend doing instead? Thank you so very much for your help, taking the time to answer questions here is appreciated.
It should be noted that my coverage tables are complete already. The data I have to input is the business, earnings period start and end dates, and total earnings in that period. The coverage tables include business, insurer, coverage period start and end dates. They are on different workbooks, but I am familiar how to reference external data on other workbooks.
Here is an example of the how the data is structured.
https://docs.google.com/spreadsheets/d/1nSotP9TYgyKeL0y_CeQXEwfs-ygaPW17LSMf9NOh6GY/edit?usp=sharing
Assuming that we have two tables: 1-INSURERS TABLE:
Insurers | Begins | Ends |
A |01/01/1980|04/15/1980|
B |04/16/1980|06/20/1981|
And 2-EARNGINGS TABLE:
#|Amount | Begins | Ends |
1| 250 |01/01/1980|03/31/1980|
2| 1000 |04/01/1980|12/31/1980|
Then we will add some extra auxiliary columns at the end of 2-table:
#|Amount | Begins | Ends | Days | A | B |
1| 250 |01/01/1980|03/31/1980|=[ends]-[begins]+1|[1-days for A]|[1-days for B]|
2| 1000 |04/01/1980|12/31/1980|=[ends]-[begins]+1|[2-days for A]|[2-days for B]|
Put this Formula into [1-days for A] to calculate days for companies and fill down from [1-days for A] to [2-days for B] using mouse :
=IF(MIN(VLOOKUP(L$3,$B$4:$D$6,3,FALSE),$J4)-MAX(VLOOKUP(L$3,$B$4:$D$6,2,FALSE),$I4)+1>0,MIN(VLOOKUP(L$3,$B$4:$D$6,3,FALSE),$J4)-MAX(VLOOKUP(L$3,$B$4:$D$6,2,FALSE),$I4)+1,0)
To get result, we should create 3-table "RESULT TABLE":
#| A | B |
1|[1-amount belongs to A]|[1-amount belongs to B]|
2|[2-amount belongs to A]|[2-amount belongs to B]|
Put this formula into [1-amount belongs to A] to calculate companies' portion and fill using mouse:
=HLOOKUP(C$16,$G$3:$N$6,MATCH($B17,$G$3:$G$6,0),FALSE)/VLOOKUP($B17,$G$3:$N$6,5,FALSE)*VLOOKUP($B17,$G$3:$N$6,2,FALSE)
It's a bit complicated, to understand, use my example file as well.
I hope I understand your problem.
The following is from your example. You can do it with the help of sumproduct.
Left side is your insurer table. Right side is the claim table.
The below is the formula you can use. As mentioned earlier. it is bit complex and works well.
=IFERROR(SUMPRODUCT(1*($G$2:$G$5>=C2)*($H$2:$H$5<=D2)*$I$2:$I$5),0)+IFERROR(SUMPRODUCT(1*($G$2:$G$5<C2)*($H$2:$H$5>D2)*(D2-C2+1)/($H$2:$H$5-$G$2:$G$5+1)*($I$2:$I$5)),0)+IFERROR(SUMPRODUCT(1*($G$2:$G$5>=C2)*($G$2:$G$5<=D2)*($H$2:$H$5>D2)*(D2-$G$2:$G$5+1)/($H$2:$H$5-$G$2:$G$5+1)*($I$2:$I$5)),0)+IFERROR(SUMPRODUCT(1*($H$2:$H$5<=D2)*($H$2:$H$5>=C2)*($G$2:$G$5<C2)*($H$2:$H$5-C2+1)/($H$2:$H$5-$G$2:$G$5+1)*($I$2:$I$5)),0)
For Sample Excel Click Here
Related
I have month columns and criteria for rows (Division, measure) and need a way to sum all divisions for a given measure and only return for the reporting month.
INDEX(MATCH) does not work because I need it to sum all Dec-18 absence values, but there are other measures in the columns as well.
My current iteration (array):
=SUM(OFFSET(D1:D53,,MATCH(Y3,$D$2:$P$2,0)))
But I can't get this to change the summing column based on the month selected.
My last guess is that I need to swap division and month (so division column headers, month rows), but I'd rather not if I'm missing something obvious.
Example:
Department | Measure | Nov-18 | Dec-18
Sales | Absence Hours | 3.5 | 4.6
Manu | Absence Hours | 6.2 | 1.7
Sales | Hours worked | 1000 | 976
An alternative solution that does not use array like calculation nor volatile functions.
=SUMIF($B$2:$B$4,$F2,INDEX($C$2:$D$4,0,MATCH(G$1,$C$1:$D$1,0)))
In the event that either your criteria or date is not found an error will be displayed. You can deal with this by wrapping the whole thing in an IFERROR function and then choose your own error message, display blank or return 0.
=IFERROR(SUMIF($B$2:$B$4,$F2,INDEX($C$2:$D$4,0,MATCH(G$1,$C$1:$D$1,0))),"NOT FOUND")
Also, if you wish to further breakdown your results but "department" and by "measure", then you could us SUMIFS which allows you to set multiple criteria instead of 1
Maybe something like this would work?
=SUMPRODUCT((B3:B5=G3)*OFFSET(B3:B5;0;MATCH(G2;C2:D2;0)))
I am creating a World Cup spreadsheet.
Example:
Team | Pts |
Brazil | XXX |
Switz. | XXX |
C. Rica| XXX |
Serbia | XXX |
I have another table which displays the Country, Score & whether it was a W (win), L (loss) or T (tie). A WIN will add 3 points, a TIE will add 1 point & a LOSS will add 0 points. Where I put the XXX, I want a formula that will search the table column for the Country Name and ADD up the W's, L's & T's and display the sum of every game there team played with the point system I mentioned.
Any help would be greatly appreciated! Thanks.
Try,
=SUM(COUNTIFS(D:D, A2, E:E, {"T","W","W","W"}))
You can use COUNTIFS. I set up a mock table to demonstrate:
The first COUNTIFS will count a given teams wins, and then multiple by a factor of 3.
The second COUNTIFS will count a given teams ties (no need to multiply here).
Since a Loss equates to 0 points, there is no need to sum or count anything.
Adjust ranges to fit your setup and then auto-fill the equation down your table to calculate for each team.
You can use a formula in H2, as below, and drag down as many rows as required
=(3*SUMPRODUCT(--($A$2:$A$13=$G2),--($C$2:$C$13="W"))+SUMPRODUCT(--($A$2:$A$13=$G2),--($C$2:$C$13="T")))
Data:
You only care about Wins or Ties. So count the wins per country and * 3 and add to that the count of ties, which you don't need to multiply as is 1.
Sumproduct is used to handle the arrays nicely.
I'm not sure how well I'm going to articulate this, but hopefully, it makes sense.
I have a Google Sheet that houses 3 tabs, 2 of which hold data while the 3rd is an overview of the 2. I'm trying to create a small search formula to easily find specific data from 1 of the 2 sheets.
Here is how one sheet looks:
A B C D
1| Name | Number | Type | Role
--------------------------------------------
2| John Doe | 012345 | Tech | MKT
3| Jane Doe | 012445 | Business | DEV
4| Jane Doe | 012445 | Business | MKT
5| Arthur | 015475 | Home | SALE
6| Arthur | 011111 | Tech | MKT
And there are about 250 rows.
What I'm trying to do is see if a specific column matches the search term added to the primary sheet.
E.g: "Arthur" in Column 1 ("Arthur" A2:A5). And, if it exists, return the data from each column in the corresponding row.
E.g: Data returned would be:
A5 (Arthur), B5 (015475), C5 (Home), D5 (Sale)
Currently, I'm using the following formula in the main sheet which searches column A in Sheet 2 (A1 is the cell where I'm typing the name, e.g: Arthur) and outputs the first row:
=Vlookup(A1,Sheet2!$A$1:$K$200,1,False)
If there is a Match, the contents of that Cell is output. In this case, Arthur.
So, is there any way of extending this to also get the contents of all Cells in the matching Row?
But, I need to ensure it's going to be compatible in the event that this file is opened in MS Excel.
Thanks
EDIT: I've managed to solve my own problem:
=IFERROR(INDEX(Sheet2!$A$1:$K$20,SMALL(IF(Sheet1!$A$1:$K$20=A2,ROW($A$1:$K$20)-ROW($C$1)+1),ROWS(A$1:K1))),"False")
However, this does not work for Duplicates.
Let's so, there are 2 Arthurs, this will only return the corresponding row for the last instance of Arthur it finds. Is there a way to have it return all of them.
Please find the below formula & the image. Hope the formula will solve your issue.If still, the problem exists please share a Sample sheet with some Sample data. I will try to resolve your issue.
Formula - =QUERY(A3:D8,"Select A,B,C,D where A = '"&F2&"'",0)
Image for reference -
If you want to include the headers please replace 0 with 1.
The simplest is the filter function. Please try:
=filter('Sheet1'!A:D, A:A = "Arthur")
Or a query function.
NOTE! query and filter are not compatible with excel.
For excel you may adopt this formula for your needs:
=INDEX('Sheet1'!B$1:B$500, SMALL(IF("Arthur"='Sheet1'!$A$1:$A$500, ROW('Sheet1'!$A$1:$A$500)-ROW('Sheet1'!$A$1)+1), ROW('Sheet1'!1:1)))
Drag it down and right to adjust the result.
I'm working on an excel sheet which has a simple structure like this.
Date | Order
-----------------------
08-15-2014 | 84
08-16-2014 | 50
08-17-2014 | 68
08-17-2014 | 78
08-18-2014 | 23
Here, in a separate column I'd like to calculate the sum of Orders by week days(Sunday, Monday and so on). Meaning, I want to see how many Orders received on Sunday, Monday etc.
So far I have come up with this non working formula.
=SUM(LOOKUP(1, WEEKDAY(date_column), order_column))
This was example for summing all order received on Sunday. And, yes Date column is in DateTime Data type so that shouldn't be a problem.
Thanks.
Consider adding a new column after the dates, representing the day values. So in column B you might have something like =TEXT(WEEKDAY(A2),"ddd").
Then if you wanted to sum up order numbers by day, you could use an equation like =SUMIF(B1:B5,"Sun",C1:C5) where column B has the day values and column C has the order numbers.
To show an example (with headers, etc):
I am a little stuck with a report I am trying to generate in Excel and was hoping someone could help.
Here is a summary of what I am trying to do:
Table 1 has one column called people (it’s basically a list of
employees)
Table 2 has one column called countries (it’s basically a
list of relevant countries)
Table 3 has three columns called person,
country and date.
There is one entry for every person each time they review a country.
So the data will look something like:
PERSON | COUNTRY | DATE
John | uk | 10/01/2013
Paul | uk | 15/01/2013
John | France | 15/01/2013
Bob | Spain | 16/01/2013
The report I need to produce is one which shows who has/hasn't checked each country.
So the columns will be ‘Person’, uk, France, Spain (and any other unique value from the country table).
There will then be one single row for each person with a Yes/No value in the relevant column if that person has reviewed that country i.e. Table 3 contains a value that matches that value for the person and country.
So to be clear the report should be similar to:
PERSON | UK | FRANCE | SPAIN
John | Yes | Yes | No
Paul | Yes | No | No
Bob | No | No | Yes
In summary I can split this into two problems:
How to generate a table that has a column for every unique value in another table (country in the explanation above)
How to do a double lookup i.e. IF EXISTS in TABLE 3 ‘person’=john & ‘country’=uk then return ‘Yes’, otherwise return ‘No’
I’m happy to keep in Excel or make use of SQL reporting i.e move my data to SQL first.
It's kind of a wonky formula but =sumproduct() will do a dual lookup.
=IF(SUMPRODUCT(--($K$2:$K$5=$K13), --($L$2:$L$5=M$10)),"Yes","No")
The Person/Country/Date table is located in the range K1:M5 the results table is located in range K10:N13. I had a workbook open and put it in the corner. (Nobody puts sumproduct in the corner)
The gist is, -- turns a true and false into a 1 or 0. sumproduct will multiply the two results line by line. If both are true, you get 1 x 1 and funnels that back into the if for a yes and no. You'll have to be mindful of th $ in the formula.