Trying to combine spreadsheets in Excel - vba

So, I have a dozen or so columns of data in excel with the headers Company, and Funded Balance. The funded balances change year to year and I want to make a timeline how the funded balance changes for each year for each company.
The issue is that every year some companies don't have a funded balance and some new companies are added in. Is there a way to combine two or more spreadsheets so that the companies will all be listed alphabetically with the data listed by the year? I've attached pictures below to illustrate what I mean:
Column 1:
Column 2:
Finished Product:
I'm fairly inexperienced in VBA, so a step by step solution would be very much appreciated. Thank you!

Firstly, it's important to know that nobody here will write your code for you. I'm afraid that's not what this website is for, and is against the guidelines anyway. There are plenty of great online resources for teaching yourself the basics of VBA - http://www.excel-easy.com/vba.html for example.
Based on your description of the problem, I don't quite understand why you need to write VBA code in order to solve it.
I would:
1) copy and paste all data into a single spreadsheet
2) sort alphabetically by company name
3) use excel's inbuilt "Subtotal" function
4) a dialogue box will appear. The options you want to select are: at each change in company name, use function sum, add subtotal to [funded balance 2005],[funded balance 2006], etc.
This should sum up the funded balance for each year, for each company, in a single spreadsheet.

Here is what I did for a non-VBA solution:
1. Place all of your tables on top of each other
2. Remove the first two rows and any intervening blank rows
from all tables except the first one. It should look like one long table.
3. In the first blank row of the second column put:
=IF(SUMIF($A$3:$A$8,$A3,B$3:B$8)=0,"",SUMIF($A$3:$A$8,$A3,B$3:B$8)) and adjust it
for your correct last row.
4. Drag the formula down (for the neccesary number of rows) and over one column.
5. With all the formulas selected, right click and hold any edge of the selection,
move off and back on again and paste as values only. (You must do this step for it to work properly)
6. Copy and paste the company names.
7. Select the three columns of your new rows and remove duplicates.
Uncheck My Data has headers.
8. Sort the columns.

Related

Excel: Increasing/Decreasing number of columns in table based on number of coloured rows from different sheet

I am in the process of creating a costing summary workbook. My main summary sheet lists a job category and then 4 rows of cost breakdown before the next category is listed. On another sheet, I have a template that the user will make a copy of for each month, which breaks down weekly work hours and then allocates hours from each employee/plant to against a job category. Please see attached pictures.
Summary Sheet -
Template Sheet
My goal is to have the number of columns on the template increase/decrease as categories are added to or removed from the summary sheet. I already have a cell that contains a count of coloured rows (category titles), and i figure i should be able to use this to determine the amount of rows that need to be added to or removed from a table. I can't think of any ways for this to be done without macros or VBA code of some kind, which I am open to but I would like to minimise the use of.
Can anyone provide me with some code or a push in the right direction for this kind of function? Category names will be stored in column A, or my count is stored in B84. Columns for each category start from column S in the template sheet.
Kyle, you can visit the following sites with a lot of vba beginners information.
http://www.excel-easy.com/vba.html
http://www.homeandlearn.org/
https://www.tutorialspoint.com/vba/
Try implementing your idea using pseudo-code.
http://www.vikingcodeschool.com/software-engineering-basics/what-is-pseudo-coding
https://www.youtube.com/watch?v=4G0EYfrrDT8
https://www.khanacademy.org/computing/computer-programming/programming/good-practices/p/planning-with-pseudo-code
Once you be able to write your code and you are having some code error or problem you cannot find a solution in the web, come again and ask specific questions, there are a lot of experienced programmers that will be happy to help you to solve your coding problems.

VBA duplicate issue

I am really stucked and I do not know how to make it possible regarding coding in VBA or any coding language. I have to do something for my workplace. I have list in the Column A in my excel sheet. I have different values in it but sometimes I have the same value in different cells in the same column. I cannot remove the duplicates because those same values are a contract-id. In the 9th column I have the total sum of the value of the contract. So it is about automatization of invoices with the help of vba.
I need to add the same values together with the total sum into a different sheet.
Let's say it looks that:
omni345 54€
omni334 2€
omni345 23€
I need to put the omni345's into one single invoice pdf. I do not know how to put them together. Furthermore I need to place those 2 same values in the invoice like this which is in a different sheet:
omni345 54€
omni345 23€
So that the client clearly can see that there are x different contracts.
What I need is the right direction how to start it.

Im trying to populate a Sharepoint list with the most upcoming dates from certain colums of data from another Sharepoint list?

I have a list named Employee Dates, this list contains the columns:
Employee | CPR Completed | CPR Required | ETC
These columns keep going on for all of the training courses required for our employees with alternating columns for completed and required dates. I am using a workflow to calculate all of the required dates of training from the completed dates.
What I desire to do is make another list that will look at ALL of the columns for the required dates and find the soonest ones and populate that list with the soonest dates and from which column it was pulled from.
Any help as to how to approach this? I have been trying to use queries in Access and also some of the custom view settings in SharePoint Designer but no luck so far.
You could try an Excel table (they also have these functions in access if I recall, but I avoid access like a plague). To connect Excel to share point follow the steps in this article:
support.office.com
Ok, now that we are connected you should see all of the columns and values in excel. Next up we need to find the min date (easy) and then get the associated column name (a little harder).
Min Date: The formula should be something along the lines of =min(B1,B3,B5), jut type in =Min( and then CTRL-click on the columns you want to consider for the row. When your done close with ). After wards double click on the square in the bottom right corner and it will do the same logic for all of the rows.
Column Name: A little more difficult, use the min value from the prior column as the lookup value for VlookUp to get the column name. After wards double click on the square in the bottom right corner and it will do the same logic for all of the rows. I'd explain VlookUp, but I'd run out of characters and attention span long before I got to the relevant parts, and excel functions does a fine job of getting you the basics.
Anyway hope that helps,

Excel - How do I find all relevant rows by typing unique invoice# listed Col A

I have a Worksheet with 10 columns and data range from A1:J55. Col A has the invoice # and rest of the columns have other demographic data. Goal is to type the invoice number on a cell and display all the rows matching the invoice number from col A.
Besides auto filter function, the only thing comes to my mind is VBA. Please advice what is the best way to get the data. Thanks for your help in advance.
Alright, I'm pretty proud of this one. Again avoiding VBA, this one uses the volatile formula OFFSET to keep moving its VLOOKUP search down the table until it's found all matches. Just make sure you paste enough rows of the formula that if there are many matches, there's room for all of them to appear. If you put a border around your match area then it would be clear if you ever ran out of room and needed to copy down the formula some more.
Again, in the main section, it's just a single formula (using index):
=IFERROR(INDEX($A$1:$J$200,$M3,MATCH(N$2,$A$1:$J$1,0)),"")
This gets to be so simple because the hard work of the lookup is done by an initial column which looks up the next row that matches the invoice number. It has the formula:
=IFERROR(MATCH($L$2,OFFSET($A$1:$A$200,M2,0),0)+M2," ")
Here is the working example that goes with those formulas:
Let me know if you need any further description of how it works, but it mostly uses the same rules as above so that it's robust in copying and moving around.
I've uploaded the Excel file so you can play with it, but everything you need to reproduce this feature should be in this solution.
Google Docs - Click link and hit Ctrl+S to download and open in Excel.
A popular solution to this problem is a simple VLookup. Lookup the invoice the user types in on the table A1:J55, and then return an adjascent column's data.
Here's an example of it working:
The formula in the highlighted cell is:
=VLOOKUP($L3,$A:$J,MATCH(N$2,$1:$1,0),FALSE)
What's nice about this formula is you only need to type it once and then you can copy it across and it'll automatically pick out the correct column of the table (that's the match part). The rest is very simple:
The first part says lookup value $L3 (the invoice number typed in),
The second part says look it up in range $A:$J (which is where your table is located). I've shown how you can select the entire columns $A:$J so that you can add and remove data without worrying about adjustin the range in your lookups. (Excel takes care of optimizing the formula so that unused cells aren't checked)
The third part picks the column from which the resulting data will be drawn once a matching row is found.
The FALSE part is an indication that the invoice number must match exactly (no approximate matching allowed)
The $ signs ensure that fixed ranges like the location of your source table ($A:$J) and your lookup value ($L3) don't get automatically changed as you copy the formula across for multiple columns.
The formula is pretty easy to adapt if you want to move around your table and the area where you do your lookup. Here's an example:
Bonus
If you want to add a little spiff, you can add a dropdown to the Invoice # field so that the user gets auto-completion and the option to browse existing values like so:

Pivot Table Grand Total at the top

We have an Excel spreadsheet with the Grand Totals at the top using a Forumla, but this isn't on the actual Pivot Table it's just in the spreadsheet.
We have a client that wants the Grand Totals at the top of the Pivot Table and doesn't want us to use Formula. Does anyone know if this is possible (even using VBA or something, just so long as we don't look for a specific column or row name and compare with it (so no GETPIVOTDATA("Grand Total...)))?
This slightly hacky solution might help:
http://www.contextures.com/xlPivot13.html
Actually, it is possible. I'm doing just that. Here's how. Let's say I in my data source, I have 1 column that contains various work orders. In another column I have all my total dollars spent for each work order, and in my final column I have a number that identifies all of the various work orders as being part of one whole group, or falling under one heading. In my case, each of the work orders fall under one project number. This will place your total at the top and at the bottom. It will also allow you to turn on and off the bottom or the top by selecting a choice under Grand Total on / off for rows / columns.
Kevin L
I'd be happy to be proved wrong, but I don't think it's possible. I think you may have to do a little work on managing your client's expectations...
It generally works. but many people in my team make different pivot table layouts. So than this "fake" grand total column really does not work anymore.
To anyone having a similar challenge, you can accomplish this by adding rows at top of the pivot table and using GETPIVOTDATA to put the values in any cell you chose. Click here for details on how to use GETPIVOTDATA to get the Grand Total of a column in a Pivot Table. The best part is that is dynamic. There's no need to reference the Grand Total row specifically.