assistance with amending an excel array formula? - excel

I have inherited a production log which contains a worksheet with multiple columns and about 8k of rows each month. I am looking to build a statistics tab, and work out for a particular time frame how many unique dates are logged against an agent.
Worksheet "log":
Column A contains agents initials
Column E contains case completion date
Worksheet "statistics":
C2 contains a dropdown of agent initials
C5 and D5 contain dates to generate a date range
I have written the following array which identifies the unique dates for the date period.
=SUM(IF(FREQUENCY(IF(Log!E:E>=CC1,IF(Log!E:E<=DD1,IF(Log!E:E<>"",MATCH(Log!E:E,Log!E:E,0)))),ROW(Log!E:E)-ROW(Log!E3)+1),1))
I just can't tie in the agents initials in Log!A:A and it matches C2.

When using an array formula, avoid using whole column references. Otherwise you'll find it very slow. Or Excel will run out of resources. Try...
=SUM(IF(FREQUENCY(IF(Log!$A$2:$A$100=C2,IF(Log!$E$2:$E$100>=CC1,IF(Log!$E$2:$E$100<=DD1,IF(Log!$E$2:$E$100<>"",MATCH(Log!$E$2:$E$100,Log!$E$2:$E$100,0))))),ROW(Log!$E$2:$E$100)-ROW(Log!$E$2)+1),1))
...confirmed with CONTROL+SHIFT+ENTER. Although, I think there's no need to test Column E for blank/empty cells, since you're already testing it for a date range...
=SUM(IF(FREQUENCY(IF(Log!$A$2:$A$100=C2,IF(Log!$E$2:$E$100>=CC1,IF(Log!$E$2:$E$100<=DD1,MATCH(Log!$E$2:$E$100,Log!$E$2:$E$100,0)))),ROW(Log!$E$2:$E$100)-ROW(Log!$E$2)+1),1))
...also confirmed with CONTROL+SHIFT+ENTER. In either case, adjust the ranges, accordingly.
Hope this helps!

Thanks Domenic that worked. I appreciate your comment about column references as I have crashed excel twice today as it ran out of resources.
If I wanted to reverse that formula to work out for a particular time frame how many unique dates are logged however i want to ignore the agent in C2. would it be
=SUM(IF(FREQUENCY(IF(Log!$A$2:$A$300<>C2,IF(Log!$E$2:$E$300>=C5,IF(Log!$E$2:$E$300<=D5,MATCH(Log!$E$2:$E$300,Log!$E$2:$E$300,0)))),ROW(Log!$E$2:$E$300)-ROW(Log!$E$2)+1),1))

Related

Trying to correctly duplicate formulas keeping same cell range but adjusting date ranges

I'm trying to help someone with an Excel spreadsheet of sales figures. I hope this explanation is clear. She has a worksheet for each category of items she sells, such as clothing, shoes, furniture, &c. Each worksheet has a column, G, for Date Sold, and the data is in Date format.
On a summary worksheet, she wants to aggregate and analyze the data, and one thing she was doing manually was counting the number of sales of each category for each month (sometimes zero).
I helped her write a formula to pull the count from the clothing worksheet, for the month of March 2019 into a cell on the summary worksheet:
=COUNTIF($CLOTHING.G3:G502;">2/2019")-COUNTIF($CLOTHING.G3:G502;">=4/2019")
This correctly yields 5. Cool. But that is just one month, and we need twelve for each year, for multiple years, and we have six categories. So we'd rather not hard-code each formula every time we need a count.
When we tried to copy the formula into cells below (for April, May, etc), hoping it would adjust the dates, it wrongly adjusted the cell range to G4:G503. The cell range shouldn't change; the months should advance, but they did not change.
We've been trying different suggestions we found online, such as naming the range G3:G502 but it didn't like that. We got an error.
We both (obviously) have a limited knowledge of Excel. Please let me know what we're doing wrong OR if there is a better way to approach this, and how to do it step by step. Please ask any questions if my explanation is not clear.
Using your formula I would adjust it as follows:
=COUNTIF($CLOTHING.G$3:G$502;">="&DATE(2019;row(1:1);1))-COUNTIF($CLOTHING.G$3:G$502;">"&EOMONTH(DATE(2019;row(1:1);1),0))
Note the addition of the $ to the cell reference. This keeps either the column or row from change when a cell is copied.
Row(1:1) will return 1 in the first cell it it entered into and as it is copied down will increase by 1. Therefore it is important not to copied it down more than 12 rows from its initial entry point.
Note the year in the date is hard coded. Alternatively the year could be placed be place in a cell and a reference to that cell could be used in place of the hard coded year. That way in subsequent years, you would just change the value in the cell instead of changing your value in the hard coded formula.
Note this solution assumes January for the first cell and months following sequentially to December for the 12th cell.
I my system is configured to use , as separators instead of ; so it is possible I may have made a mistake with those in my edits.
Alternatively you could look at COUNTIFS. It is similar to COUNTIF but requires all entries to be TRUE for an entry to be counted.
=COUNTIFS($CLOTHING.G$3:G$502;">="&DATE(2019;row(1:1);1);$CLOTHING.G$3:G$502;">"&EOMONTH(DATE(2019;row(1:1);1),0))

Excel formula to say if a date range is available/unavailable from a list of date ranges?

I'm creating a booking system in Excel and need a formula to tell me if a given date range is available/unavailable from a list of date ranges (bookings).
There's an excellent article on Chandoo.org here about testing to see if two ranges of dates overlap. However the formula provided only works when comparing one set of date ranges to another single set of date ranges. Whereas I require this to work/search through a multitude of date ranges.
=IF(OR(y<a,b<x),"Do not overlap","Overlap")
Take the bookings below for example:
*Bookings*
Start Date End Date
25/01/2019 26/01/2019
29/01/2019 31/01/2019
01/02/2019 03/02/2019
Based on the above, the following dates are available:
21/01/2019 24/01/2019
27/01/2019 28/01/2019
If I fed the formula either of these two sets of dates, I would expect the outcome to read "Available".
Subsequently, the following dates are unavailable:
23/01/2019 26/01/2019
30/01/2019 02/02/2019
...and the formula should read "Unavailable".
As far as I'm aware, the logic around the formula from Chandoo.org does not work when converted to an array of search/compare criteria.
I thought I came close by using an array within two separate =COUNTIF() statements for each comparison y<a or b<x, however the outcomes weren't always correct.
The fact that a simple formula exists comparing two individual sets of date ranges makes me a believe a more complicated formula is derivable which compares a single date range to an array of date ranges.
Any help or guidance is much appreciated.
Thanks,
Mr J.
I hope this solution will help:
Assuming your actual Bookings are present in columns A&B (I copied your dates into cells A3:B5), and your four potential bookings are in columns D&E (cells D1:E4), you can paste the following formula for the first row:
=IF(COUNTIFS($A$3:$A$5,"<="&E1,$B$3:$B$5,">="&E1)+COUNTIFS($A$3:$A$5,"<="&D1,$B$3:$B$5,">="&D1),"Overlap","Do not overlap")
Drag & copy it to the remaining 3 rows. You should see "Do not overlap" for the first two dates and "Overlap" for the remaining two bookings. Let me know if this is what you were looking for.

Extract data between two dates

I have a bunch of data on the first sheet (Manifest) of my Excel file.
Like this:
On the ByDate sheet, I want to be able to put in two dates, and then display all the data between those two dates from the Manifest sheet. (Based on the date on Column G [named DATE REQ'D] for the Manifest sheet)
So I follow instruction by:
https://www.youtube.com/watch?v=6jcqN3swdW8&t=322s
On my cell A7 (where I want the data to start) I put:
=IF(ROWS($A$7:A7)>C2,"",INDEX(Manifest!$G:$G,SMALL(IF(Manifest!$G:$G>=ByDate!$A$2,IF(Manifest!$G:$G<=ByDate!$B$2,ROW(Manifest!$G:$G)-ROW($A$7)+1)),ROWS(A$7:A7))))
For some reason, I don't get any data but the number 42741. This can be seen in my second picture.
Can anyone tell me what I did wrong and how to fix it?
Update:
I changed the cell's format to date. But my problems are:
1.The date that appeared is not in between the two dates.
2. I thought when I dragged the cell across (copy without formatting) I would get the rest of the data such as order Number, customer...etc but I just get blank spaces:
While in cell A7 on the ByDate worksheet, go to the HOME tab of your ribbon, then to the Number group and click the drop-down.
Now select one of the date options (either Short Date or Long Date) to get your number to appear as a date.
A quote from the Help guide for Excel: Excel stores dates as sequential serial numbers so that they can be used in calculations. That's why your date looks like a number instead of a date.

Excel: Return Multiple Items with One Lookup Value but on a different sheet

My formula works, but only if its in the same page, and along the same rows
Formula:
=(INDEX($C$1:$D$4,SMALL(IF($C$1:$C$4=$F$2,ROW($C$1:$C$4)),COLUMNS(D1:D4)),2))
Note: Column G has the formula, what it does it look for value in F2 (which is 1.2) within the columns of C & D, and extracts the respective data in column D. So in this case, it would extract the data in column G.
Question: Now what do I do if I want this to occur from different sheets, or even different workbooks? I need to do this exact same thing, extract the data that is in column c and d (which is on a different workbook) to my workbook.
Every time I try, I get a value error.
Bonus: I'm also trying to get the date that is closest to today's date, I have this formula here:
=IF(COUNT(G2:G5)>0,INDEX(G2:G5,MATCH(MIN(ABS(G2:G5-$D10)),ABS(G2:G5-$D10),0)),"")
Where D10 is just equal to =TODAY() and this entire formula works by pressing ctrl+shift+enter
If you can also include this into the formula so that it just spits out the closest date in G2 rather than spit out all the dates. But it is not necessary, just helps a lot.
For your "Closest to today problem", I was trying to spread the difference of the date or a comparison of the date just like in your example. This is just not working out. I solved the problem by adding another column. I do not know if this is a valid option for you or not, but here is what I have. Assuming H is available or you can insert a new column H. use this dragged down for each row - in your exampl 2 thorugh 5.
=ABS(D$10-G2)
Then add this in H10 or wherever you see fit
=D10-(MIN(H2:H5))
Here is an excel-ish example
5/12/2014 =ABS(D$10-G2)
5/13/2015 =ABS(D$10-G3)
5/14/2014 =ABS(D$10-G4)
5/15/2014 =ABS(D$10-G5)
6/6/2016 =D10-(MIN(H2:H5))

Excel formula for earliest date ONLY when value a second column matches the value a third column

SOLVED - No further efforts required. Formula below.
I am trying to create a function that works across two worksheets to find the earliest date if it matches criteria in 2010. The goal is to continuously see the most out-of-date item that has the same "name", so that it can be reviewed and made current. The process repeats.
The first worksheet produces a summary for a product. The second is a collection of metadata for the product. I would like to find a function that compares a column to a single cell on the first worksheet and produces the earliest date from the rows on the second worksheet that match.
Here's the basic idea:
IMGUR LINK TO SCREENSHOT OF CONCEPT. Sorry. Doesn't seem to let me embed.
It is important that if a 4th AA is added, the formula finds it and continues to account for it.
I've tried some combinations of IF, VLOOKUP, and MINA or MIN, but can't seem to get it to work.
The closest I've gotten is
=MIN(IF(A11:A18=A3, C11:C18, broken).
But that doesn't seem to work when I raise the amount of values in the arrays.
Any help would be appreciated. Thank you.
SOLVED: Function was correct. I forgot to use "ctrl+shift+enter". Keeping post active for others to reference.
Try
=MIN(IF(A3=Sheet2!A:A,Sheet2!B:B)) entered as an array formula (Ctrl+Shift+Enter)...This formula assumes that your text criteria is in Column A of Sheet 2 and your date criteria is in Column B of Sheet two. This formula would be pasted in cell B3.

Resources