Autopopulate Excel invoice using vlookup - excel

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.

Related

Filtering or Importing data for specific date

I was wondering if anyone knows if it's possible to import a data, in a sort of a COUNTIF function but only for the data dated today?
I have 2 sheets, Attendance and Department.
In the Department tab, I have a list of employee's in column A. In column B and so on, I have a drop down option to select which department they're are stationed for each day. Each column represent a day, B being the 1st, C being 2nd, ... and so on. The header for each column has the day for the day as well.
On the attendance sheet, I have the list of Department in column A and in B, it is used to record how many employee are stationed at that department. I also have the day for the day on this sheet on A1.
Is it possible that when I change the date, the number of employee stationed in each department will change according to the date?
Is it possible to do this with just functions?
I've tried using the COUNTIF function, but I've found that I will have to change the range on a daily basis.
Use The Function: in B4 of Attendance Tab
=COUNTIF(INDIRECT("Department!" &ADDRESS(3,MATCH($A$1,Department!$A$2:$P$2,0)) & ":" &ADDRESS(6,MATCH($A$1,Department!$A$2:$P$2,0))),$A4)
Results: Attendance Tab
Department Tab:
I have used all the references as in the screenshots, you can change them if they are different in your sheet.
your question can be solved by SUMPRODUCT function. See below solution picture:
SOLUTION
Just to quickly explain my solution, I gave a name to the date on the Department sheet, called it 'Date_Lookup'; and I gave a name to the dates on the Attendance sheet, called it 'Date_List'. Names will simplify my formula especially when referencing across worksheets.
You will eventually find a lot of COUNIF scenario can be solved by SUMPRODUCT and this is just one example. SUMPRODUCT can do a lot IFs than COUNTIFS can do. In your case there are two criteria, one is which department did an employee attend to, and the other is on which date did the employee attend to that particular department. So my SUMPRODUCT formula can be understood as:
=SUMPRODUCT(('from the list of dates'='the particular date I want to see')*('from the full attendance record'='how many employees went to the given department'))
Let me know if you have difficulties understand my answer. A good 1 hour read through some online articles regarding SUMPRODUCT will help.
Cheers :)
Your first step would be to use a function to work out in which column the entered date appears. So in your Department sheet you enter a date in A1, then set B1 to:
=IFERROR(MATCH(A1, Attendance!2:2, 0), 0)
I use the IFERROR as I don't like seeing errors on my sheet. Assuming the result isn't zero, use a COUNTIF looking for the department letter in a range in the result column. I'd simply use on OFFSET to get the right range, but sticklers would tell you to find a different way of doing it. So long as your spreadsheet isn't going to increase in size to a massive complexity, OFFSET is fine.

Existing array formula, need to add date restriction

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.

How can I find number of entries of a particular type within a given time period in Excel? [duplicate]

As the title states, I am trying to count across cell ranges on a separate sheet but cant seem to get it to work. Any help would be greatly appreciated.
=COUNTIFS(MONTH(original!A2:A58),"1",original!D2:D58,"=East")
The issue is the Month() part in your formula. I understand your logic, but you'll have to probably add a new column on the Original sheet that has the month formula conversion there, then update the countif to reference it.
COUNTIFS(Original!monthcol, "1", Original!col, "East")
Again, in summary the Month formula can't do the conversion for an entire range of cells in the CountIf. The only other way would require an array formula. Hope this helps.
You cannot use the MONTH function as a form of sub-function in a COUNTIFS function. You need to add an extra level of calculation with something like a SUMPRODUCT function.
=SUMPRODUCT((MONTH(original!A2:A58)=1)*(original!D2:D58="East"))
That should count the instances where the month of the date in the Original worksheet's column A is January and the corresponding row's column D is East.
If you prefer to stay with a COUNTIFS and can keep the dates to a single year, you can provide a start date and end date which will bracket the month of January for a particular year.
=COUNTIFS(Original!A2:A58,">="&DATE(2015,1,1),Original!A2:A58,"<"&DATE(2015,2,1),Original!D2:D58,"East")
The default comparison operator for COUNTIFS is equals. There is no need to type it in.

Attempting to count cells in Excel using multiple criteria

As the title states, I am trying to count across cell ranges on a separate sheet but cant seem to get it to work. Any help would be greatly appreciated.
=COUNTIFS(MONTH(original!A2:A58),"1",original!D2:D58,"=East")
The issue is the Month() part in your formula. I understand your logic, but you'll have to probably add a new column on the Original sheet that has the month formula conversion there, then update the countif to reference it.
COUNTIFS(Original!monthcol, "1", Original!col, "East")
Again, in summary the Month formula can't do the conversion for an entire range of cells in the CountIf. The only other way would require an array formula. Hope this helps.
You cannot use the MONTH function as a form of sub-function in a COUNTIFS function. You need to add an extra level of calculation with something like a SUMPRODUCT function.
=SUMPRODUCT((MONTH(original!A2:A58)=1)*(original!D2:D58="East"))
That should count the instances where the month of the date in the Original worksheet's column A is January and the corresponding row's column D is East.
If you prefer to stay with a COUNTIFS and can keep the dates to a single year, you can provide a start date and end date which will bracket the month of January for a particular year.
=COUNTIFS(Original!A2:A58,">="&DATE(2015,1,1),Original!A2:A58,"<"&DATE(2015,2,1),Original!D2:D58,"East")
The default comparison operator for COUNTIFS is equals. There is no need to type it in.

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