Pick the value of different cell against particular cell - excel-formula

i have data in such manner for full month
Name | Date | Workdone
--------+---------------+-------------
Mike | 1/1/2015 | aaaa
Tina | 1/1/2015 | sssss
Andrew | 1/1/2015 | eeee
Symond | 1/1/2015 | ffff
Mike | 1/2/2015 | gggg
Tina | 1/2/2015 | hhhh
Andrew | 1/2/2015 | nnn
Symond | 1/2/2015 | jjjj
Now i want a summery of each person for full moth in below manner
Mike
------------+-------
1/1/2015 | aaaa
1/2/2015 | gggg
Symond
------------+-------
1/1/2015 | ffff
1/2/2015 | jjjj
Kindly help me to prepare data in such manner by using formula

You're going to want to use a pivot table to achieve this summary.
Go to the insert tab in excel - select PivotTable on the far left - select data range.
Once the pivot table is inserted in the spreadsheet, on the far right of the screen you can select the attributes you want to view.

Related

Fill down excel values between dates

I have an excel sheet (called Sheet1) with rows of data that look like this:
Unit | Names | Begin_Date | End_Date
-----------------------------------
A | Jones | 1/1/2016 | 1/4/2018
A | Frank | 2/11/2018 |
B | Adam | 3/5/2011 |
C | Jane | 6/9/2012 | 7/14/2016
C | John | 7/28/2016 | 9/22/2017
C | Joe | 12/31/2017 | 1/1/2019
C | Joe | 1/2/2019 |
I am trying to get it into a format that has the units as column headers and dates as rows. The idea is that for every day between the begin and end dates, the name of the person should be in the appropriate cell. If there is a gap between the end date of one person and the begin date of the next within the same unit, the formula will list "vacant". It is assumed each unit was vacant before the first "begin date" for that unit, and blanks for end dates mean that the person still occupies that unit. Ideally the completed data set would look like this, on Sheet2:
Date | A | B | C |
-------------------------------------
3/5/2011 | Vacant | Adam | Vacant
3/6/2011 | Vacant | Adam | Vacant
...
6/9/2012 | Vacant | Adam | Jane
...
1/1/2016 | Jones | Adam | Jane
...
7/14/2016 | Jones | Adam | Jane
7/15/2016 | Jones | Adam | Vacant
7/16/2016 | Jones | Adam | Vacant
...
7/28/2016 | Jones | Adam | John
...
1/4/2018 | Jones | Adam | Joe
1/5/2018 | Vacant | Adam | Joe
etc.
The formula I have thus far populates the first values, i.e. the first person to live in the unit or, if no one, then it lists "vacant" on Sheet2. However, I am not sure how to extend it to look for the next person. I've listed all the dates in column A and all of the unique Unit names in row 1. Any help or advice would be appreciated!
=iferror(if(index(Sheet1!Names,match(1,(Sheet2!A$2=Sheet1!Begin_Date)*(Sheet2!$A3=Sheet1!End_Date),0))=Index(Sheet1!Names,match($A2,ArrayFormula(min(Sheet1!Unit=B$2,Sheet1!Begin_Date)),"Vacant",Index(Sheet1!Names,match($A2,ArrayFormula(min(Sheet1!Unit=B$2,Sheet1!Begin_Date))),Index(Sheet1!Names,match($A2,ArrayFormula(min(Sheet1!Unit=B$2,Sheet1!Begin_Date)))
This uses aggregate and is basically an array formula but without having to be entered with
CtrlShiftEnter
=IF($F2="","",IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($A$2:$A$10)/
(($A$2:$A$10=G$1)*($F2>=$C$2:$C$10)*(($F2<=$D$2:$D$10)+($D$2:$D$10=""))),1)),"Vacant"))
Aggregate(15,6...1) woks out the minimum value of the array inside it, ignoring any error values. This array consists of the rows 2-10 divided by the conditions on the rows. The conditions are set up (as you did) using * for AND and + for OR. Where the conditions are false, this leads to a division by zero which gives an error, so only the rows which satisfy the condition are taken into account.
You can also use this
=IF($F2="","",IFERROR(INDEX($B$2:$B$10,MATCH(1,
($A$2:$A$10=G$1)*($F2>=$C$2:$C$10)*(($F2<=$D$2:$D$10)+($D$2:$D$10="")),0)),"Vacant"))
entered as an array formula.

Lookup rate with Index/Match with two criteria including one date range

In our Consulting business, we charge our clients according to a personal billing rate. These rates can change over time. To be able to invoice customers for any service back in time, I want to build an Excel sheet that can facilitate this process.
+--------------+------------+------------+-----------+
| Name | Begin | End | Rate |
+--------------+------------+------------+-----------+
| Paul Brown | 2016-01-01 | 2016-01-31 | $10.00 |
| Paul Brown | 2016-02-01 | 2016-03-02 | $20.00 |
| Paul Brown | 2016-03-03 | 2016-04-02 | $30.00 |
| Paul Brown | 2016-04-03 | 2016-05-03 | $40.00 |
| Anna Red | 2016-02-15 | 2016-03-16 | $100.00 |
| Anna Red | 2016-03-17 | 2016-04-16 | $127.00 |
| Anna Red | 2016-04-17 | 2016-05-17 | $145.00 |
| Martin Blue | 2016-01-01 | 2016-04-30 | $300.00 |
| Martin Blue | 2016-05-01 | 2017-02-25 | $400.00 |
| Susan Yellow | 2014-01-03 | 2014-12-29 | $10.00 |
| Susan Yellow | 2014-12-30 | 2016-08-21 | $30.00 |
| Susan Yellow | 2016-08-22 | 2016-09-21 | $50.00 |
| Susan Yellow | 2016-09-22 | 2016-10-22 | $190.00 |
| Susan Yellow | 2016-10-23 | 2016-11-22 | $200.00 |
| Susan Yellow | 2016-11-23 | 2016-12-23 | $210.00 |
+--------------+------------+------------+-----------+
In my Excel Sheet, I want to be able to enter the name of the person and any date and it should give me the correct billing rate.
So e.g. typing Susan Yellow and 08/26/16 should return $50 because it fell in this date range.
+-------------+------------+----------+
| Susan Yellow | 2016-08-26 | $50.00 |
+-------------+------------+----------+
Dates before the first billing rate should default to the first known one, and ones with no current billing rate should default to the last known one (e.g. 01/02/2018).
Normally, I would just use an Index/Match formula but my issue is that I cannot combine criteria / build a helper column because that breaks the date range function. I could define custom table arrays instead, but I do not know how long each search area is because some consultants can have quite the history and others might be short.
Anyone have a clue with what formula I can solve this in Excel/Google Sheets?
Thank you!
Edit:
SottCraner's formula is much neat and simple.
=SUMIFS(D:D,A:A,F3,B:B,"<=" & G3,C:C,">=" & G3)
This should work : {=SUM(IF(F3=$A$2:$A$16,IF((G3>=$B$2:$B$16)*(G3<=$C$2:$C$16),$D$2:$D$16,0),0))}
This will deal with the two situations where the date is not in ranges as required:
It is an array formula, so with required name in G1, and required date in H1, enter it in I1 with
Ctrl-Shift-Enter
=INDEX($D:$D,MAX(MAX(IF($A$2:$A$16=$G$1,IF($H$1>=$B$2:$B$16,ROW($C$2:$C$16)))),MATCH($G$1,$A:$A,0)))

Selecting from Many to many

How can I in Excel, resolve this question about this table:
Invoice Number | Item | Product | Value
1001 | 1 | potatoes | 100
1001 | 2 | tomatoes | 150
1002 | 1 | potatoes | 100
1003 | 1 | water | 50
1004 | 1 | potatoes | 100
1004 | 2 | onions | 120
If I ask the questions:
Which an how many of these invoices have no potatoes or tomatoes ?
the answer should be, in this case: invoice 1003 / number = 1
How can I find it in Excel? Is there a formula for this question?
You can do it using the helper column. Place the following formula in it:
=IF(AND(COUNTIFS($A$2:$A$7,$A2,$C$2:$C$7,"potatoes")=0,COUNTIFS($A$2:$A$7,$A2,$C$2:$C$7,"onions")=0),IF(COUNTIFS($A$1:$A1,A2,$E$1:$E1,"Ok")=0,"Ok",""),"")
copy/paste the formula to the whole column, then you can use the count() function or filter by "Ok" values.
The feature you want to use is Pivot Tables. It's really easy to do exactly what you want with just a few clicks once you learn how to use that feature.

Moving range/array reference in Excel table

Friends, I'm hoping you can help. I'm fairly certain I found a solution to this problem below a while ago, but silly me didn't write it down and now I can't remember how I did it. I'm drawing a blank on what to search for (Google is flooded with answers on "dynamic named ranges", which is not what I'm aiming for here). So, the question:
How can I define a range within a formula (say, RANK for example) that moves as I progress down through a table? I'm trying to avoid using INDIRECT, because it becomes a bit of a memory/processor hog when repeated throughout a large table. Pretty sure there is another way, maybe with INDEX or MATCH?
A simplified version of the data would appear as follows:
Column A has a bunch of reference numbers, each one repeats a few times.
Column B has a bunch of timestamps
Column C is where I would like to rank the timestamp in column B, as compared to all other timestamps that share the same reference number in column A.
The result set should look like this:
| A | B | C |
| abc123 | 01/01/2014 12:30 | 1 |
| abc123 | 01/02/2014 12:30 | 2 |
| abc123 | 01/02/2014 13:30 | 3 |
| abc123 | 01/03/2014 09:30 | 4 |
| def456 | 01/01/2014 12:30 | 1 |
| def456 | 01/01/2014 12:45 | 2 |
| xyz987 | 01/02/2014 12:30 | 1 |
| xyz987 | 01/02/2014 16:30 | 2 |
| xyz987 | 01/03/2014 11:30 | 3 |
Any ideas on what would be the least taxing solution for the processor in this case?
So here is the trick:
copy and paste in C1 and drag and fill down till end.
=IF(A2=A1;SUMPRODUCT(--(A$1:A$9=A1);--(B1>B$1:B$9))+1;SUMPRODUCT(--(A$1:A$9=A1);--(B1>B$1:B$9))+1)
this is an array formula, so press ctrl+shift+enter to calculate the formula
Here is the example sheet in this file downloadable from this link
P.S. remember to adjust the formula to your regional settings by replacing the ";" with "," . Have fun.

Automatically populate Excel rows from another sheet

I have an Excel document containing 2 sheets:
All purchases
Invoices
I would like to find a simple method to add items from 'All purchases' to 'Invoices' based on the date.
Example:
All purchases:
Date | Name | Sum
----------------------------------
2013-01-01 | Pottery | $12.00
2013-01-01 | Liquids | $1.00
2013-01-09 | Baby food | $12000.00 <
2013-01-02 | Car | $12.00
2013-01-09 | Lego | $50001.00 <
2013-01-02 | Car part | $10000.00
2013-01-09 | More Lego | $50001.00 <
Based on the date 2013-01-09 I want to automatically fill the 'Invoices' in the following way:
Date | Name | Sum
----------------------------------
2013-01-09 | Baby food | $12000.00
2013-01-09 | Lego | $50001.00
2013-01-09 | More Lego | $50001.00
Can this be done without macro?
I know about camera, pivot tables, lookups, indices, but I could not combine them into a usable solution.
My other plan is to look up the collection for every cell and retrieve the 1st one for the 1st row, 2nd for the 2nd row. Is there a simpler solution?

Resources