How to group by mixed values and sort by date in a PivotTable? - excel

I am attempting to create a spreadsheet with a lot of data captured in it. The two requirements I have to meet are 1) group jobs/parts with the same PROJECT #, and 2 sort by JOB START DATE. I thought PivotTables were the best way to do so, but I keep running into a brick wall. I'm either unable to group by Project # (most likely because they are a mixture of numbers and text, this cannot be changed), or I'm unable to sort by Job Start Date.
I've tried moving Project # and Job Start Date from Rows to Values, as well as changing the order they're displayed in (Job Start Date before Project # and vice versa).
If grouped and sorted correctly, the records should show the grouped PROJECT # with the earliest start date first, then the next group with the next start date, etc.
An example would be:
>2074, 68506, BUC10626, 3/4/19
>>2074, 68568, AUC15393, 3/4/19
>>2074, 68570, AUC14509, 5/30/19
>2552, 69920, 99163786, 4/1/19
>>2552, 71066, H695359, 6/5/19
>1166, 71527, 5450926, 5/16/19
>2497, 71138, 2436-923, 6/11/19
>>2497, 73445, H646427, 7/24/19
>2704, 72682, AUC11771, 6/24/19

Pivot tables build a hierarchy. If you have a cascade of Project > Job > Part > Date, then you can only sort by date within the container of the previous level, i.e. Part.
If you have more than one part in the hierarchy, then different dates will show up sorted inside that part, e.g.
ProjectA
JobA
Part A
January 'these rows are
February 'sorted by
March 'date
Part B
August
September
Part C
March
April
If you want the projects sorted by date, then you need to have the date column before the project column.

Related

INDEX/MATCH based on date criteria within two files?

I have two files. File A has supply type 1 purchase orders, File B has supply type 2 purchase orders.
File A has three columns Name order # date
File B has three columns, too, the same as file A.
I need to add in the File B order # as long as its within a week of the date of what's on file A.
Attached is a visualization to better model the problem.
I need a mix between a =index/match + IF + Date statement to compare the two files and only bring in the order number if the dates between those rows are similar, and to leave out the duplicate orders that are too old.
If the order numbers are just numbers (no text), then you can use SUMIFS:
=SUMIFS(G:G,F:F,A3,H:H,">="&C3-7,H:H,"<="&C3+7)
If you've got text or a mix of numbers and text, then you can use AGGREGATE.
=INDEX(G:G,AGGREGATE(15,6,ROW($A$1:$A$4)/(($F$1:$F$4=A2)*($H$1:$H$4<=C2+7)*($H$1:$H$4>=C2-7)),1))
=INDEX(G:G,MATCH(1,(ABS(C3-H:H)<5)*(A3=F:F)*(ABS(C3-H:H)<5),0),1)
The following index / match formula returns an order number from file b if the name is the same and if the order b date is within 4 days of the order a date.
You can update the formula where it is highlighted in the screenshot and change the number of acceptable days for an order to be considered similar. Please keep in mind that if multiple orders meet your criteria (e.g. John made many orders one day after the other) your INDEX formula will only return one order # and could potentially lead to matching the incorrect invoices.

Excel Help - using IF and WORKDAY functions to generate a due date

I am trying to forumlate an IF statement that will generate a due date by taking a given date and adding business days to that dependent on a value in a separate column.
I started off with:
=IF(E3="Fatal",D3+1,IF(E3="Life Threatening",D3+1,IF(E3="Non-Fatal",D3+3,IF(E2="Non-Life Threatening",D3+3,IF(E3="Non-Susar",D3+5,"")))))
But this does not use the WORKDAY or WORKDAY.INT functions at all and is something I am now needing to add. I have collated a list of bank holidays to add into the new function these are listed - 'Backend Sheet (No Edit)'!C1:C752
Example of the sheet is below, I basically need to have it add 1,3,5 business days to the "query received date" dependent on the value in the "seriousness" column and print the new date into the "first attempt due by date" column
Appreciate any help that can be given!
Put your seriousness in a separate helper table along with the days adjustment. Then use workday to find your attempt date.
=workday([date received], index([helper table adjustment],match([this table seriousness],[helper table seriousness],0)),'Backend Sheet (No Edit)'!C1:C752)

multiple lines made into 1 line of data

I have attached a picture of what im trying to do.
I run these reports on my techs once a week. on the left side of the picture it shows the service order number multiple times and then the the booked date and closed date the techs id number actual hours work and then sold hours. the problem is it has many lines with the same service order. i need to make it look like the line to the right. 1 usable line of data so that i can process the reports the way i need to.
Copy A1:E32 all your Data without column F and paste it in I1 it will be I1:M32 for example, select I1:M32 the new Data under Data Tab click on Remove Duplicates you will have one row for each different entry
If the Number in Ro-no (column I) is unique for each entry, use the following in N2:
=Sumif($A$2:$A$32,I2,$F$2:$F$32)
and drag it down
It will sum the Sold Hours in column F for each RO-NO
Change the references to include all your rows and keep $
Power query
One of solutions is to use MS power query addin. In Office 2016 and alike the PQ is built-in feature, located on the Data tab, Get and Transform group.
Let's say we have data like this:
We can use the Power query to Group By, like so:
The query will remember the steps you 'teach' it.

Find Next and Latest Date, With Conditions

I have a list of asset IDs and service dates. I'd like to find the last service date and the next service date for a specific asset (each in their own column, with each row corresponding to an asset ID). The way I tried it was to use a formula like this:
{=IF(MIN(IF(Lists!$J$11:$J$31 = 'Action Overview'!A2,Lists!$K$11:$K$31))=0,NA(), MIN(IF(Lists!$J$11:$J$31 = 'Action Overview'!A2,Lists!$K$11:$K$31)))}
This would be to find the last service date, and I'd use 'MAX' in place of 'MIN' for the next service date. The problem is that my list contains dates before the last service date and after the next service date, so I wind up with dates far in the past and far into the future. I think the way to fix this would to be to use =TODAY() to get the current date, and use logic that says "maximum date for this asset less than or equal to current date" for the last service date and "minimum date for this asset greater than or equal to current date". I just don't have the familiarity with Excel's functions to make this work.
Any help you can provide with this would be greatly appreciated.
Thanks,
Dan
I managed to find a solution myself. Here's what it came out to be for the last day in for service:
{=MAX(IF(Table4[Asset]='Action Overview'!A2,IF(Table4[In Shop]<=TODAY(),Table4[In Shop])))}
And here's what it was for next service date:
{=MIN(IF(Table4[Asset]=A2,IF(Table4[In Shop]>=TODAY(),Table4[In Shop])))}
Table4 is just the table I have the schedule set up in. You'd just select the range you have your values in if you weren't using a table.

Create View Eliminating Records of X Date

I am trying to create a view to find records of a certain date but the results are not what I want for an end result.
To start I want to view records who's start date is 3 weeks out. Simple enough.
.... StartDate | Next X Weeks | 3
This gets my records that are 3 weeks out cool......but it also returns records that are 1 week and 2 weeks out...which I don't want....but I don't see any way to exclude when working with dates? For example this psuedo query....
.... StartDate | Next X Weeks | 3
.... StartDate | ! Next X Weeks | 2
.... StartDate | ! Next X Weeks | 1
Now I haven't dug into seeing if this can be done by writing FetchXML directly....I figured Msoft would have addressed this by now and incorporated it into the UI...but perhaps I am wrong?
The UI only incorporates a subset of available operators. You could, However, use a dynamically built fetchxml which allows you to use the greater then operator and a specific date (today + 3 weeks).
But this means you need to create your own view using something like the following using a webresource or an iframe.
Well unfortunately this logic isn't capable with FetchXML alone http://msdn.microsoft.com/en-us/library/gg309405.aspx
The "not" concept doesn't apply to dates, otherwise you could use the AND logic you specified above.
You can however create a web resource and then query the data you want via JCL or another library. Then you can parse the results to filter the first two weeks via JavaScript.
Or you can create the view with 3 weeks and sort by the date descending. This leaves extra noise at the end of the view, but may suffice.
I am very grateful to Paul & ad1ka's responses and they definitely taught me something new. However both were not quite what I was looking for and that I'm quite confident that is only because of my poorly worded question.
Here is what I ended up doing and feel free to comment / criticize.
I created a DateConmstants entity and added five records (there will be more). (The records have a name, date, and corresponding view name that it applies to).
I then created a maintenance workflow that executes every night to update the dates. For example record 1 is always to be 2 weeks out so the nightly workflow will update the record with the process exec time + 14 days.
I then created the views needing dates adjusted...(with bogus dates for now)
with OnOrAfter and OnOrBefore thus creating a date "sandwich".
I then created a custom workflow that updates these views. It takes an input array of the views to be updated and the records from dateconstants that match the view.
The workflow then finds the view, loads the fetch into an xml. Using the xml find single node I find the OnorAfter and OnOrBefore values and update them. Then push the xml back to to query definition. Update and publish changes.
Finally this is scheduled as part of the afore mentioned nightly maintenance job.
So every day the users have views displaying the correct records with nothing extraneous.
FWIW

Resources