Existing array formula, need to add date restriction - excel

I have been tailoring an excel sheet for budget analysis using a pivot table.
Works quite well actually!
One of the fields I have above the table is a reporting of the 1st, 2nd and (depending on the schedule the 3rd) pay check in a month.
Right now I am using this formula:
1st
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),1))
2nd
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),2))
3rd
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),3))
As you can see in the formula, it's referencing another sheet in the file. What I am trying to do is move the source data to a whole separate file that will be a continuous dump of our bank statements. I've successfully pointed the pivot table source to the new file and it's pulling everything in fine, then applying a date filter for the table for whichever month we're on (set manually).
The catch with this formula I pasted is it works great for finding the 1st, 2nd and 3rd occurrence of the specified keywords, but of course only if a months worth of data is in the sheet.
How would this be changed to allow a date filter?
I.e cells A1 and B2 would be 5/1/18 and 5/31/18, use those two cells to define what the formula should look within to return the needed result.

EDIT: New formula. AND doesn't behave that way with array formulas.
Just add the date conditions to your IF statement. Say your dates in bk_download were in column A and your filter dates were in A1 and B1, this should work for the first formula:
=IFERROR(INDEX($D$2:$D$32, SMALL(IF(($B$2:$B$32="DFAS-CLEVELAND FED SALARY ***********xxxx")+($A$2:$A$32<=$B$1)+($A$2:$A$32>=$A$1)=3, ROW($B$2:$B$32)-ROW(INDEX($B$2:$B$32,1,1))+1),1)),"None")
Change "None" to whatever value/message you want when nothing is found.

Related

Generate or fill cell data based on another dataset excel

I've a data set that shows;
employee name
date
time work started
time work ended
Now I am trying to have a report like sheet where I can select a certain employee name from a list of employees to view his/her time attended for a particular month.
I tried vlookup but went no where since I need to lookup by two columns plus a row.
Is this possible? without macros or vba.
Thanks
Since name and date are unique identifiers it is possible to use the sumifs function.
For ‘time in’ and ‘Rachel’ this will look as follows:
=Sumifs(column ‘time in’ from data set, column ‘name’ from dataset, “Rachel”, column ‘date’ from data set, “10/01/2017”)
Where Rachel and the date also can be a referenced cell.
=AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1)
The above formula will grab the row number that matches your criteria. to pull the information you want, you can place the row number inside an INDEX formula to get the following:
=INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1))
You can place the above in your first Time cell and copy right and down. You will see errors if criteria do not exist. ie no person of that name or no date data for that person. to avoid this you can wrap the whole thing in an IFERROR like the below:
=IFERROR(INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1)),"Nothing found")
if you would rather a blank than nothing found display change the "nothing found" to "" or 0 if you want 0 to be displayed.
Note: Aggregate is performing array like calculations in this case. As such you do not want to full column references as it will cause a lot of unnecessary calculations to be performed. Because you have unique entries, SUMIFS option given in another answer is a much better choice.
I think a pivot table will do the job for you.
Place the employee name in the filter, place date and
times in the rows.
Remove subtotals from the Pivot Table
Change Table layout to tabular and Repeat rows
Right click on the Time In and select Ungroup
Then you have the image below.
I have the following layout:
In B11 write this formula and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),3)
In C11 write this and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),4)
Note that these are Array-Formulas, so you need to enter them with CTRL + SHIFT + ENTER instead of the normal Enter.
You will get a #NV error if the employee hasn't worked on one of the dates A11 and A12. So you could surround the Formula with IFERROR to avoid this.

Guide me Regarding Compare the Value of Cell contain date and other cell contain Drop down list

Hy Every One, I need help in excel formula, I have two sheets, sheet1 for sale tracker, sheet two for goals tracker, I used Now() to enter date automatically, and its working fine, Next in goal sheet, I use =Sumif() to calcualte various category totals and refer them in cell. Its also working fine. But I want to track record according to month and category. Like I have 6 categories detail is as under,
Sales Tracker
In the First picture Column Date consist of formula "=IF(ISBLANK(B5),"-",TODAY())" and it display the name of month like "October"
While in second picture there is a drop down list of "Month" Column.
1- I want to use if statement like =if(Date=Month, Sum(Revenue Secure column Data), "-") But its not working the formula I wrote here is an example....
2- I want when I select any month from second sheet like January, February, It should calculate sum from picutre one data and only show the sum of january etc.
Please help me, this is eating my brain a huge,,,,,,:)
Thanks in advance....
In short my question is how can I use If statement to compare value of cell that contain formula and other that contain drop down list?
Or use the MONTH function to change your date to a number 1 to 12 corresponding to the month. Then have the combo return a number for the month chosen. It might be faster using integers than test
I Believe you have to compare the month and not the whole date.
You can do TEXT(NOW();"mmmm") to get the full month name of the current data (in the language of excel) and then compare it to your drop down.
If you replace the NOW() with any data it works as well.

How to show a value in one cell when current week is in another cell in excel

My first time to this forum.
I am a free range poultry farmer and I am trying to make spreadsheets to monitor my flocks. I have made the flock specific input sheets and now working on getting information for all of them into one summary sheet.
My question is...
I have the age of the birds going down column A also I have dates by week end date going down Column B... I would like to know how to have it that in one summary cell when the current date falls into one of the weeks listed in Column B that the corresponding cell in Column A is shown in that Summary cell (showing the current age of the flock). I would like this obviously auto update when the date progresses into another week.
Can any one help??
Thanks
Put the current date in the header (=TODAY() function or variations).
Name the current date cell (e.g. Current_date)
If your data are in table format I recommend putting them in a Table, this will insert your formulae to any new row started. If you dislike them you can simply create filters.
Use the formula in say C5 "=B5=Current_date" This will give you a logical expression, TRUE or FALSE. You can filter for TRUE to see the flocks to sell/cut.

Autopopulate Excel invoice using vlookup

I'd like to auto-populate an invoice in Excel from data I enter into a lesson roster (blank_monthly.xlsx).
Here I fill in the lesson cost under the date each time they come for tuition.
In the invoice sheet I would like to start writing a customer's name into a cell, I'd like the rest of the table to populate with information from the current month's customer roster.
Can I use =vlookup for this to reference the cell I type the client's name into which then pulls all the other information?
If your names are split on the invoice sheet, but not the lesson plan, then you can use VLOOKUP with wildcards as below
Lesson Plan sheet
Invoice sheet
* in the VLOOKUP function will match any characters.
=VLOOKUP("*"&$A2&"*",Sheet2!$A$2:$G$4,2,FALSE)
If your names aren't split then you can just omit the wildcard search, as below.
=VLOOKUP($A2,Sheet2!$A$2:$G$4,2,FALSE)
Currently if no matches are found then the function will return 0. If you just want a blank cell, then you can nest the function in an IF
=IF(VLOOKUP($A2,Sheet2!$A$2:$G$4,2,FALSE)=0,"",VLOOKUP($A2,Sheet2!$A$2:$G$4,2,FALSE))
VLOOKUP documentation is HERE. You should read up on it.
I assume your data sheet will contain 3 columns like: name, date of lesson and number of lessons. You then want to produce a nice report that your illustrated. The short answer is 'Yes', you can use VLOOKUP provided that you only have one row in your datasheet per person per day and you have a column with the concatenation of Name and date. Otherwise, you have to use SUMIFS. I recommend SUMIFS because it would be cleaner formula.
The name is easy to match. Date should handle itself, as long as you don't try to control Excel's magic. Date is stored as a number. The cell formatting makes it look like a date. Concatenate your Month, Day, Year to the proper format and use the DATEVALUE function.
If you have your anchors ($) correct, you should be able to copy and paste the formula. If you don't want to see 0s on your summary report, don't IF in the formula, control it using cell formatting - custom 0;;.
If you are familiar with Table vs Range, use table. Your formula will look nicer and you don't have to worry about extending your range as you acquire more lessons.

Excel Advanced Filtering Issues - Advice Needed

So basically I have a main table, and I want to filter that data to another table (normally easy) but I want this based upon 2 criteria. e.g. I want to filter the data of a specific department but only for the current month. The way I display the current month in the main table is by inserting the date from a userform and then by formatting that cell to just display the month. However, when using advanced filter I use the column headings that I want to filter e.g. department: mens, month: november (worked out using =now() then formatting to just display the month) but when I'm running the filter it's not picking out the information at all.
I think this lies with the way the month is worked out and displayed but I can't figure out another way to do this. Any help is greatly appreciated.
I'm also open to trying a new method of just selecting data for the current month if anyone has a cleaner way, as I'm sure there is one.
You have to use a formula in your criteria to specify what month you want to extract. But it's not terribly intuitive. Take a look at this sample. My starting list is the range A1:B7. My criteria is in range D1:E2. The Department is straightforward; I just entered "3". (Obviously, without the quotes.) But instead of a Month criteria, I added "GetMonth" and entered the formula shown in the formula bar. You can name this whatever you want, but it can't be the same as one of the headers in your source list. (Yeah, I checked.) The formula checks to see if the current month of the date in cell B2 is 12, which is December, and returns TRUE or FALSE. You could use 11 for November. The advanced filter will apply the reference to cell B2 that's in the formula in a relative fashion to all cells in the Month column. And Viola! my output in range A10:B11 is what you'd expect it to be.

Resources