Comparing dates in two columns with matching criteria - excel

I'm trying to fill out a sheet with a somewhat complicated criteria, I have four columns I'm interested in, however the columns are mixed into a much larger table, sorry vlookup :(
There are two columns that contain an ID# and a Category, one column with date and time stamp, and one that MAY contain a date and time stamp. (Column1,2,3,4 respectively)
Column 3 is when an action took place, Column 4 is the next time that action with the same ID# and Category has to have been completed by.
Essentially I need a cell(s) that will check for a date in Column 4, if there is one, find the next value in Column 3 that is greater than that of column 3 in the row with the value in Column 4, AND has the same ID, AND Category and compare them to see if it was done on time, preferably also by how much if it was late.
I'm able to find it almost with:
{=MAX(IF([#[Column 2]]=[Column 2],[Column 4]))}
Entered as an array formula, however that will only give me the last time that Category was given a "Next Due Date" and similarly with Column 1 replaced for Column 2 in the code sample above, I only get the last time that ID# was given a "Next Due Date".
As some Event ID# can be around for many days, and can run concurrently with others there's no guarantee all IDs will be grouped, nor Categories within those IDs.
It appears any attempts to add an AND(.. function break the array, though I'm not positive I'm not just messing up the placement of it.
It's perfectly fine if the solution involves creating helper cells.
The table is sorted chronologically by column 3 with the latest date at the top if that's any help.
TYVM for even taking the time to read this :)
Edit 1:
Sample Data
I've included an image with some sample data, to clarify the awkward sentence above. The orange arrows are pointing to two dates that would be compared and the event was late. the Green points to a group that was on time.
the categories are
Those two are being compared because each set has the same category, and ID. I hope that clears it up :)

You could try this formula (goes into column E):
=IFERROR( IF($D2<>"", LOOKUP(2,1/($F1:$F$2=$F2),$C1:$C$2), ""), "")
Very important here are the $ signs, as the searched area is supposed to move with the row. (Note: this formula goes into E2. You then copy > pastespecial (only Formulas) it into the rest of the column.)
My table looks like this:
A B C D E F
ID Category Start-date Due-Date Completion-Date ID+Cat. (Helper column)
The formula in F is simply =$A2 & $B2. The data starts in Row 2.
You will need to replace the columns with yours.
Please let me know if this is what you were looking for.

Related

Multiple Responses in Excel's Reverse Lookup

I'm trying to make a schedule of available workers after they have given me their availability. I would like a list generated of all people who say they can work on a specific day.
Ideally I would create some kind of list that looks like this:
I'm actually trying to schedule volunteers for my swim team, not employees, but the idea is the same. The form that they are filling out can also have blank spots (not shown in data table above, but possible) and the dates in the first column will also be out of order. I can manually fix both of those things, but if there is a solution that does not require me to fill in the blanks or sort the dates that would be ideal. I'm using Excel 2019 on a Win10 PC.
Starting in I2 you would have
=IFERROR(INDEX($B$1:$G$1,AGGREGATE(15,6,COLUMN($B$2:$G$7)
/(INDEX($B$2:$G$7,MATCH(I$1,$A$2:$A$7,0),0)="yes"),ROWS($1:1))-COLUMN($A:$A)),"")
so you are finding the right row in B2:G7 by doing a match on the date in column A, then finding the first, second, third... column which has a Yes in it, and finally getting the matching name from the first row.
You can see what's happening by stepping through the formula with evaluate formula:
(1) find the right row in B2:G7 by index/match
It's matching the date (stored as a number, 43466) against the list of dates in column A. The matching position is 1, which gives the row, and the column parameter in the Index function is 0 so you get the whole row.
(2) Find which cells contain 'yes'
The values in the array which do contain yes will be replaced with true and the ones which don't will be set to false.
(3) Do the division
This is the crux of the whole thing. What aggregate is going to do is to ignore the #div/0 entries (because we used option 6) and work out the lowest (minimum) column which corresponds to a 'yes', which is 2. It's the lowest because rows($1:1) just works out to 1 so you get the 'first smallest'.
(4) Adjust the column so that you get it relative to the first column of B2:G7. You could just subtract 1, but I'm trying to make it so that it still works if you insert a column to the left of the range.
5) Then all that's left is to index into the list of names in B1:G1
ending up with Albert.
As the formula is pulled down, rows ($1:1) changes to rows ($1:2) etc. so you get the second smallest column with a yes in it and so you get the second name. Eventually it errors out when there are no more matching names so IFERROR comes into play and you get a blank cell.

Production Calendar - Excel

I always bite off more than I can chew when it comes to my Excel knowledge. I am hoping someone could help me with this.
Essentially, I have two sheets, first is "Schedule" which is a data dump from MYOB with what we have on order with the warehouse to produce.
I then go through and plan what needs to be made on what day over a two week period.
I'd then like this to be put in a user friendly calendar in "Plan".
I thought of doing a comcatenate to make the week and day unique, and used an IF And formula. Then i realised all I am doing is making it look for the first line.
Is there a way to do what I am asking in Excel?
I guess what I want the calendar to look up a category, EG DUCT, then place anything with Duct in the respective concatenated calendar line.
spreadsheet can be found here
http://www.castekauto.net/stack/PlanningSchedulestack.xlsx
TIA
After some changes to the planning table which include:
Filling column A with Week-Day
Unmerging the column headers (for Duct for example)
Standardizing the fields you need (Composite Hose changed to Hose for example to match the Schedule worksheet)
I used the following array formula (entered with Ctrl+Shift+Enter):
=IFERROR(INDEX(INDIRECT("Table3["&C$6&"]"),SMALL(IF((Table3[Helper]=PLAN!$A7)*(Table3[STOCK CATEGORY]=PLAN!C$5),ROW(Table3[ITEM CODE])-8),ROW(7:7)-MATCH("zzz",$B$1:$B7,1)+1)),"")
Sample workbook uploaded here.
A bit of mumbo jumbo if you want to understand the formula break down a bit:
IFERROR(Result, "") simply will show blank if the result is an error (there are no more items that can be displayed)
INDEX(Column Result,SMALL(Matches, N)) Here Column Result is where the result of what we need comes from. It can be Item Code, Description or Quantity. Matches is a list of index for the rows that matched some specific criteria (Type of material, whether it's in the same week and day) and N is the Nth result we need. If N is 1, then we get the first result of the matches, if N is 2, we get the 2nd.
From the above, I used INDIRECT("Table3["&C$6&"]") for the Column result to make the formula a bit more flexible. When it is like this, the formula will decide which column it needs to return, whether it's the Item Code, Description or Quantity.
Matches is defined by IF((Table3[Helper]=PLAN!$A7)*(Table3[STOCK CATEGORY]=PLAN!C$5),ROW(Table3[ITEM CODE])-8) which basically checks if the week and day matches, together with the Stock Category. If both matches, then return the row number of those rows (the result is an array).
N is defined by ROW(7:7)-MATCH("zzz",$B$1:$B7,1)+1), which is kind of a small algorithm I've used so that after each new day, I get a new N starting at 1, that increments by 1 until a new day is reached. It basically takes the current row, subtract the last row up to the current row from column B and add 1. If the two are on the same row, the result would be 1. If the current row is one row below the last row from column B, the result will be 2, etc.

Excel - Find all identical cells, sum separate cell in row for matches, output in other sheet

So, I've searched for an answer to this, but I can't find anything. Hopefully some Excel guru out there has an easy answer.
CONTEXT
I have a sheet that has two columns; a list of airport codes (Col A) and a list of fuel gallons (Col B). Column A has a bunch of duplicate entries, column B is always different. It's basically a giant list of fill-up events for aircraft over time at different airports. The airports can be the same, because it's one row per fill-up event.
PROBLEM
What I want to do is have a formula that takes the enter data set, finds all identical entries in Col A, sums the Col B values for the matches, and spits out the result on a separate sheet with one entry for every set/match.
OTHER STUFF
I do not have a reference list for Column A and I would rather not create one since there are thousands of entries. I would like to just write a formula that does all this at once, using the data itself as the reference.
All the answers I find are "create a reference list on a separate sheet", and it's driving me crazy!
Thanks in advance for any help!
-rt
Sounds that you need a formula version of remove duplicated for column A, and a simple sumif for column B.
Column A
=IFERROR(INDEX(Data!A$1:A$1000,SMALL(IF(
MATCH(Data!A$1:A$1000,Data!A$1:A$1000,0)=ROW(Data!A$1:A$1000),ROW(Data!A$1:A$1000)),ROW())),"")
Array Formula so please press Ctrl + Shift + Enter to complete it. After that you might see a {} outside the formula.
Column B
=SUMIF(Data!A$1:A$1000,A2,Data!B$1:B$1000)
Just change the range for your data.
Reminders: The formula in columnA should starts from Row#1, or you have to add some offset constant for adjustments.
Since the returning value of MATCH() represents the position of the key in the given array. If we wanted it to be equal to its row number, we have to add some constant if the array is not started from ROW#1. So the adjustment of data in Range(B3:B1000) is below.
=IFERROR(INDEX('Event Data'!B$3:B$1000,SMALL(IF(
MATCH('Event Data'!B$3:B$1000,
'Event Data'!B$3:B$1000,0)+2=ROW('Event Data'!B$3:B$1000),
ROW('Event Data'!B$3:B$1000)),ROW())-2),"")
Further more, the range should exactly the same as the data range. If you need it larger than the data range for future expandability, an IFERROR() should added into the formula.
=IFERROR(INDEX('Event Data'!B$3:B$1000,SMALL(IFERROR(IF(MATCH(
'Event Data'!B$3:B$1000,'Event Data'!B$3:B$1000,0)+2
=ROW('Event Data'!B$3:B$1000),
ROW('Event Data'!B$3:B$1000)),FALSE),ROW())-2),"")
Lastly, I truly recommended that you should use the Remove Duplicated built in excel since the array formula is about O(n^2) of time complexity and memory usage also. And every time you entered any data in even other cells, it will automatically re-calculate all formulas once the calculation option in your excel is automatic. This will pull down the performance.

Get all rows from a sheet, into another sheet, where each row contains a cell matching a certain value

I'm looking for a solution without VBA due to work limitations.
The schema of my sheet is as follows:
SheetName: 'Spend Track'
Row 4 - headings
A B C D E F G H I J
Date, Originator, Supplier, Description, Receipt, Type, Account, Gross, GST, Net
Row 5 onward is data.
In another sheet (called Kevin); I want all the rows from Spend Track! that
match the condition Bx='Kevin'. Where x= the given row number.
So if Spend Track has 10 rows, 3 of which belong to Kevin. The sheet Kevin will have 3 rows and will update when new rows are added in Spend Track.
Thanks!
The main problem is to get a list going in Kevin of the row numbers you need. Following the hint of Tim Williams, here is a way. In some work column of the "Kevin" sheet (that can be hidden later if needed), where I will use column "A", create a column starting in row 4 (or put a header in row 3, first), to keep things simple, that says in its top filled in cell, =if('Spend Track'!B4="Kevin",row(),1000000), where a million is comfortably bigger than the number of rows in the first sheet will be. This gives you a column of either the row numbers with Kevin in them (your x's) or a million.
Now in another work column parallel to the first, B in my example, but not needing to be quite as long, starting in the same row, do, and drag down, =small(A$4:A,ROW()-3), and presto, you get a list of the row numbers with Kevin in them, followed by millions.
Once you have the row numbers, INDEX, will do the rest. Where you want your outputs to begin, put in =index('Spend Track'!A:A,$B4), drag right until it becomes =index('Spend Track'!J:J,$B4) and down as many rows as you can imagine wanting matches.
This will give you all the desired rows.
On a Google Sheet, the references beyond the end of Spend Track leave things blank, but it appears that in Excel you will get a row of unsightly 0's. If that is so and it bothers you, the formula can be adapted to =if($B4=1000000,"",index('Spend Track'!A:A,$B4))
That should do it.

Return last date something was entered into one column with criteria from another column

I'm working with a set of data in excel. Data is entered into rows for items specified in columns. The first column contains a date. A cell in the same row of one of the columns contains the name of a person and in another cell in the same row but different column may contain a number larger than zero (or it may be empty).
I need to create a formula which returns the date when a number larger than zero was last entered into that column for a specific name. This is a "living list" which keeps on growing and the same names appear in different rows, sometimes with a number in the column a mentioned and sometimes not.
I found an old thread on this site on a similar subject which got me as far as knowing the date of the last entry containing the persons name but I'm still not able to configure it to show me when that specific person also had a number larger than zero in that column.
Here's the thread: How to get the newest value from a column with conditions
My current formula looks like this:
=INDEX($A:$A,MATCH(MAX(IF($G:$G=Sheet7!C5,$A:$A,0)),IF($G:$G=Sheet7!C5,$A:$A,"")))
CTRL+SHIFT+ENTER
Column A contains the dates
Column G contains the names (and "Sheet7!C5" is a reference to a name)
The value column I need to add to the mix is column AY
I feel there must be a simple solution (a small add on to the formula) to solve this but I always end up with an error.
Thanks in advance :)
Edit: Here is a simplified example of the data entry and output list needed.
For this you need to sort the date DESCENDING and format the table as Excel Table
Edit: you can sort the date ascending. See explanation at the end.
Using your example, then the formula will be
=INDEX(TableData[Activity A], MATCH($B14, TableData[Employee initials], 0))
This works just like the usual VLOOKUP or INDEX MATCH, fetching the first date on an activity matching the employee initials.
You can use VLOOKUP, but you'll need to dynamically name the range of each columns.
Edit: Just today I found an interesting behavior of MATCH when it found multiple matching values. If you use 1 instead of 0, then it will fetch the last matching value on the list.
So, you can use this formula instead in ASCENDING table.
=INDEX(TableData[Activity A], MATCH($B14, TableData[Employee initials], 1))

Resources