I am trying to create a Monthly Net Income/Expense Sheet.
I have a small manufacturing firm and based on orders we receive i want to add monthly Expense and Income.
I have created a small sheet
I have 3 sheets right now
Orders List basically has Names of all orders i receive for example Washing Unit. I have defined a name so that it will be a drop down selection as can be seen in image as Order Name
Now my Washing Unit is EXACTLY same as this sheet except it doesn't have Order Name
I want to know if I select Washing Unit from Dropdown how can I link the entire Row data into my Washing Unit Sheet
e.g if I put Description and date,income and expense and then i select Washing Unit, it should be added as an entry in Washing Unit sheet and if I select None it will be removed from there
So long as you wish to extract data from a single cell in another sheet the best way to do it should be using the INDEX/MATCH worksheet function.
Do you have some code of your own that you've tried? I suggest you try writing some then come back for help to perfect it.
Some hints:
Use the worksheet_change event of sheet "Jan".
To reliably identify rows to add or remove, you need another field in "Jan" and "Washing Unit" - let's call that "Order Number". It doesn't have to be fancy, it just has to uniquely identify each order.
You set worksheet_change to check for changes in the "Order Name" column. If it finds one, it grabs the order number from the changed row and looks for that order number in the "Washing Unit" sheet.
If "Order Name" is "None" it deletes any rows with that order number from "Washing Unit".
If "Order Name" is "Washing Unit" and the order number is not found, it finds the first empty row in "Washing Unit" and adds the order there.
Edited to add:
That should be 'If "Order Name" is NOT "Washing Unit" it deletes any rows with that order number from "Washing unit".'
Changed because it occurred to me you might have other order names and from time to time you might need to correct an incorrect order name.
But you still need to write your own code!
Without seeing the which columns you have your data under, A, B, C etc. I'm not able to create something that will definately work on your sheet but the formula below is what myself and Variatus are suggesting you use.
=IFERROR(INDEX(Jan!$A$1:$E$1000,SMALL(IF(Jan!$D$2:$D$1000="Washing Unit",ROW(Jan!$A$2:$A$1000)),ROW(1:1)),2),"")
What you can create with a formula like this is a dynamic filtered version of the data you have on your sheet Jan so that as you add "Washing Unit" entries they will be autimatically listed on the Washing Unit sheet.
The fomula is looking at the whole table of data on sheet Jan and then it is comparing the data in column D Jan!$D$2:$D$1000="Washing Unit" to see if it contains "Washing Unit". This formula would be placed at the top of sheet Washing Unit and it displays the first match ROW(1:1) and takes the data from the second column of the specified range ROW(1:1)),2),"") so you put the formula under the corresponding column in your Washing Unit sheet.
Once you have entered the formula you must use CTRL+SHIFT+ENTER instead of just ENTER to make it an array formula and add {}. You can then drag the formula down as many cells as you think you might need. (You'll see the data in the cells as you do this).
Then, go back to the top and copy the first cell over to the next column and change the number in the formula that specifies the column you want to extract data from ROW(1:1)),2),"") to 3 of the number that corresponds with your heading and again use CTRL+SHIFT+ENTER to add the curly brackets {} and auto-fill down again.
Repeat until you have all the columns you need.
It's not an easy formula and you need to remember the CTRL+SHIFT+ENTER to ensure that it works but you can have a go and see if you can get it working.
Related
I am not sure how, if at all, this can be done. Basically I have a report that is generated from SalesForce for some co-workers. It exports to Excel in this nice little table. Depending on their team, they filter the results and then filter the month (fiscal year in this case).
What I want to do is have text populate at the top which is based on the text that is in the first cell in the column C (not including header row of course) when they filter. How do I go about referencing the spot where C4 is currently when they select Team "White-1" and Fiscal Year "Aug"? That cell will become hidden and I will need to pull the data from C6 which HAPPENS to be in the location that C4 was just in before being hidden.
Here is an image of the report in Excel as well as the "location" that I want to reference no matter the filtering that the employee does:
Report
I assume VBA will be needed. Preferably I want to generate the text in A1
If you are ok with adding a "Helper Column" you can do the following to get the results you are wanting:
Add a column between B and C Give it a header of some kind I used "Helper". Then in this new Column use use the formula =Row() to generate a number for each row.
You can hide this column now if you want.
Then in whichever cell you want the answer you seek enter the following formula:
=Vlookup(Aggregate(5,5,C:C),C:D,2,false)
Now you can filter all you want and you should get the result you wanted.
Moving forward, slowly.......
I added a column, that with the combination of my checkboxes, gives the name of active employees.
Screen Shot of active list of employees
If I use $T$6:$T$16 as my validation list, I still get 11 options in the drop down. I want the drop down to show only the 5 names that are in that list.
No need to use VBA here, Here's a quick solution.
Use a 1 or 0 in a column next to the employees' names corresponding to whether they are active or not.
Then create a column in the sales sheet which has a vlookup for this value
=VLOOKUP(E4,$A$4:$B$8,2,FALSE)
This looks for value E4 (the name), in range of all names, second column for their active status, FALSE for an exact match.
Then use a filter:
Highlight range of sales
"Data" tab
"Filter"
Then you can use the filter on the new Active column to only show the employees which are still active. See the linked image for the final outcome. The vlookup lives in column D.
Final outcome image in Excel
Of course if you want this in two sheets, you can split what I've done to different sheets with no extra effort other than adding sheet references to the range in the vlookup.
Hope this helps
hope you are all doing well today! I've been working on a spreadsheet that tracks invoices and the hours recorded for each one. Each invoice has multiple entries with different numbers of hours for each entry, all with the same reference number which combines the project number and the invoice number. For example, for Invoice #1 of project CZ23, the reference number would be CZ23-1. Invoice 2 would be CZ23-2, and so on. This is located in Column I, while the hours are located in Column H in a sheet named "Document Data".
Now I have another sheet that tracks the hours called "Summary". What I want to do is have cell B28 of "Summary" add up all the hours from CZ23-1 from "Document Data". Since I barely know any VBA, I don't have code but I'll display the situation here:
In this case, cell B28 on "Summary" would be 15 (all the CZ23-1 hours added up: 2+5+1+7), while B29 would be 7 (all the CZ23-2 hours added up: 4+3) and so on. It doesn't necessarily have to be B28/B29, but just as a reference I've used those cells. Thank you so much for your time - hope I was able to explain everything well.
Best way to do this would be to create a pivot table.
1. Select a cell inside your data and then on the insert tab select pivotTable.
2. A "Create PivotTable" box will pop-up. Verify that your data is captured in the Table/Range. Also, you can choose if you want to have the table appear on a new sheet or the existing sheet.
3A. In the "PivotTable Fields" box, you can drag "Reference" to the Rows box and then drag "Hours" to the Values box. This should default to Sum and should add up all the Hours by Reference.
3B. Occasionally the Values box will default to Count. To change this to SUM, you can select cell B4 or B5 (See Below). Right click and select Value Field Settings. When the "Value Field Settings" box pops-up, you can select Sum on the "Summarize Values By" tab.
It sounds like you want the sql concept of 'group by' on column 'Reference'
In excel you can do this by using pivot tables
You will find pivot tables in the toolbar at Insert-->Tables-->PivotTable
I'm trying to get a msgbox when a value is duplicate base on 2 columns. The first column Value can be repeated but the second column will determine if it's a duplicate or not.
i.e.
Column B = Code,
Column L = Month
The user can enter the Code several times, but if he enters it on the same month I want the msgbox pop up
Is your intention to warn\inform the user? If so, I would do this without a macro. I would use conditional formatting to make the cell change color whenever the duplicate information is entered.
Create a column on your worksheet with a formula that concatenates the information in column B&L the formula would be =B1&L1 (copy this formula down the table). You can hide the column so nobody sees it. For this example, let's say you used column "M".
Select the entire Code or Month column (or both) and click the CONDITIONAL FORMATTING button on the Home tab, choose NEW RULE, USE FORMULA TO DETERMINE WHICH CELLS TO FORMAT, then enter the following formula: =COUNTIF($M$4:$M$1000,M1)>1 (note I am assuming your range of data is less than 1000 records, otherwise increase that number). Set the format to something like a red fill and instantly duplicates will be flagged. The user will also be able to quickly locate the record where this combination was already entered as that will turn red too.
If you really do want a macro to do this, you could simply write a loop to compares the active cell value of B(activerow) & L(activerow) to each previous B#&L# combination. If a match is found, use the intersect method to pop-up a the message. Here is really a good article about the intersect method: http://www.ozgrid.com/VBA/vba-intersect.htm.
Situation:
I have two sheets: The first sheet contains a list of employee names; the second sheet contains a piece of a pay report for employees. I need to pull the employee pay data from sheet 2 to sheet 1 by searching for the employee on sheet 2. What complicates this is the report on sheet 2 contains changing employees, pay, and has no unique ID.
I am looking to fill in column A. I cannot permanently modify this sheet as it affects downstream reporting.
I split column B which was previously first name, middle initial (if any), last name. Note, about 10% of the names may have a different last name. For example, sheet 1contains the name Tara Feather, but the second report uses her maiden name of Tara Bird.
Attempts so far:
I am new to Excel, and am just learning VLOOKUP. My first attempt was to pull the data based on the last name column on sheets 1 and 2, and enter data. Unfortunately, while that worked for 90% of the entries, the last 10% had the wrong values and the audit to correct took more time than manual entry.
Possible Ideas:
My next thought was to combine an If statement and VLOOKUP so that if last name matched, and first name matched, then execute the VLOOKUP and pull values, or enter "ERROR".
With this new thought, I don't know if I'm now in macro territory or if there are a combination of functions that can help. Ideally, the more it can do with 100% accuracy the better. However, if it can highlight the names it completed on sheet 2, I can always enter the non-highlighted manually, still saving time.
What are your thoughts and direction?
You want 100% accuracy, but if someone has different names on the two sheets, then that's never going to work.
So to get 90% of it right:
On the second sheet put this formula in G2 and copy it down for as many rows as you have names.
=B2&D2
Put this formula in H2 and copy it down
=F2
On the first sheet put this formula in A2 and copy it down
=VLOOKUP(D2&C2,'second sheet'G:H,2,false)
Any rows where it can't find a matching firstname and surname will have #N/A in them.
Assuming you can modify the second sheet permanently you can put the right surnames in so that the formulae work. You could also put in the middle names into the formulae in case you have two people with the same names.