I have two sets of data that contains some of the same information. This data is Names, b-days and other information about people. Each person is contained in one row through multiple columns.
Any ideas of how to make a script through VB to check all information from one person in one set of data with all of the data in the other set? I need to Highlight any names that are not in both sets. e.g.
(If another way in excel is available that works too) Cannot download any other software
Set 1
Somebody, Bob 9/2/2012 Male
Someonelse, Joe 8/16/1950 Male
Set 2
Somebody, Bob 9/2/2012 Male
In this case I would need to highlight Someonelse, Joe in Set 1.
Acual data contains a few thousand people. Efficiency of script not a huge deal, as long as it gets the job done.
Do you have an example? I'm not very familiar with how Excel works. Thank you! – Scape 27 secs ago
If your intention is to find the values which are not in SET 2 then you can use the Countif formula in conjunction with an IF formula. See the snapshot.
And if you want to highlight the cell then use conditional formatting using a formula :)
Related
I have found a couple places that this has been touched on but I am not a programmer by any means so I am having difficulty using what I have found. I have been teaching myself VBA for access but I am very lost as to how to go about this in excel.
I have two work sheets in my workbook. One is called "Field" the other is called "DTE" in the Field sheet I have employees tracking the number of ballasts that are installed at a certain job site. The DTE is more indepth and is the sheet that our customer needs. Our guys are not at all tech savvy so I need to find the easiest way (one button click type of situation) to have the information transferred from "Field" to "DTE".
Here is some information on the data:
Field contains three tables (they are currently left to right but I can make them top to bottom if that is messing the codes up)
The first table is for ballasts, second for fixtures. There third is not necessary for this question.
There are multiple types of ballasts and fixtures which is where the difficulty comes in.
For example:
I need to have certain information transferred over, on the field form the guys type the location as well as how many of each type of ballast/fixture. In the DTE I need this information to be arranged slightly differently.
If the Row in the field form looks like this:
Location Ballasts 1 Ballasts 2 The second looks like this:
Hall 3 4
and then I need the DTE to look like this
Location Quantity Type
Hall 3 Ballasts 1
Hall 4 Ballasts 2
I know this is extremely in depth and I apologize in advanced because this is much more difficult than I wanted to make it but if anyone could help I would really appreciate it. Thank you so much!
(Also if you think another answer may help please link me to it, I have tried to use many of them and alter them to fix my tables but I just come up with a ton of errors. Thank you again!)
I have 40 Excel Workbooks each with 25 Worksheets containing data in columns A:Q and variable number of rows (would be less than 5000 rows).
Each of the 40 Workbooks represents 1 Team. Each of the 25 Worksheets is 1 month's worth of data and the sheets are named 'Jan-15', 'Feb-15' etc... to 'Dec-16', so obviously only 5 sheets have data within them so far (as it is now May-15). Each workbook is set up for future data.
I need to get all the data into one place, which I thought would be best to use a pivot table. So far, I have set up an additional workbook that contains VBA code to pull the required data into one Pivot table. It does this by having checkboxes on a Sheet for each team and more checkboxes for each month. If the checkbox is checked (= TRUE), then the data for that team and month will be pulled through.
E.g. If 'Team 1' and 'Jan-15' is selected, the pivot table will show Team 1's January data. If 'Team 5' and 'Mar-15' is selected, then Team 1 and Team 5's Jan and March data will be pulled through.
Is does this in VBA by compiling an SQL string of the required data (my SQL knowledge is limited to 2 days' research!), such as:
SELECT *
FROM `Team 13.xlsx`.[JAN-15$]
UNION ALL
SELECT *
FROM `Team 13.xlsx`.[FEB-15$]
UNION ALL
SELECT *
FROM `Team 13.xlsx`.[MAR-15$]
UNION ALL
SELECT *
FROM `Team 15.xlsx`.[JAN-15$]
UNION ALL
SELECT *
FROM `Team 15.xlsx`.[FEB-15$]
UNION ALL
SELECT *
FROM `Team 15.xlsx`.[MAR-15$]"
etc....
Sometimes I will only need to see, say Team 3's data for Jan-15 and Feb-15, sometimes I'll need Teams 1 to 10's data for Mar-15 and sometimes I'll need to see all 40 Teams' data over the last 12 months.
However, I am struggling now, because this only works for a certain number of selections. I only need to select up to 12 months at a time, so I have limited the number of 'month' checkboxes that can be selected, but I can't select all 40 of the Teams and all 12 months as I get an error message that says
Run-time error '1004': [Microsoft][ODBC Excel Driver] Query is too complex.
If I only select 10 Teams and 5 Months, or 40 Teams and 1 Month, the Query runs fine, but I need more.
Is my SQL code wrong, or is there a better way to write it?
Or is there another way that I can combine all this data? (I only have Excel, not Access, at my disposal!)
Your query is good, you have, just as the error says, simply created too complex a query for the poor Jet* Engine to handle. I would suggest that you break it down into a simple loop where you handle each team/month check box combo as a separate query, each one pulling data into your master sheet and appending it to then end of your data set that the pivot table is built off of.
With some testing, you may determine that you can pull a team for a year without overwhelming the database engine, and write your code to work that way (up to 12 Union's, for example), but that would make your code more complex. You may find that it will execute a bit faster by not having to make so many SQL queries, but then again, because they are more complex, they may execute more slowly.
*Yes, I know it's not called "Jet" any more, but I choose to let the Wiki link handle the fine lines, and most people probably still call it that despite what Microsoft wants us to do.
Thank you to the people that responded to this question. Your help and experience is greatly appreciated :-)
I have managed to sort this out today using the comments posted; using VBA to loop through workbooks and worksheets using the checked boxes to copy the data from each sheet into a master sheet within another (report) workbook and then to use VBA to create a pivot table from the master data.
Thank you to FreeMan for posting an answer, however unfortunately my SQL and Query skills are very limited and I didn't understand or know how to implement your suggestion! So I thought my VBA solution would be the easiest for me to do and it works.
I think initially I was over-complicating the issue with trying to use Query/SQL, but I found that that was the way to go based on the research I did trawling the 'net beforehand. I thought that copying all the data across may be too time consuming and difficult, but it turns out it was not.
I can post the code I used to check the checkboxes, open a file, select worksheets, copy data across and create a pivot table if anyone needs to do the same.
Hopefully this can help someone out in the future!
NGH
I have a list of employee details. I want to split each employee detail in separate Excel sheet. I tried a lot but I get only separate Excel files alone, not all the sheets in a single file by using Pentaho kettle.
Eg:
Raja 22 developer 25000
ravi 23 tester 2000
karthik 24 designer 4000
Mani 28 developer 45000
In that each employee details will need separate sheets in a single excel file. Already, I worked with "MS excel writer" but it did not work.
EDIT
Thanks for your valuable reply,its really clear and more useful. :-) But i need one more detail from you,if i added age,skill ,salary columns into the get variables, after run the job ,i didn't get the values of these three fields only their column names shown in every sheet. I need to include their column values in each sheet
example : sheet 1 : (raja)
Name age skill salary Raja 22 developer 25000
sheet 2 :(ravi) Name age skill salary ravi 23 tester 2000
Like that i need to generate each sheets,I hope you get my point. Can you please help me how to i generate that.
You need to copy the rows (employee names) into memory and then loop it across the excel file to generate multiple sheets with employee names. I have uploaded the codes in this location. You can view it.
First of all, i took an excel input and used "copy rows to result" step to load the data to the memory.
In the Second Step, loop all the data in the memory and write it across the excel file. You can loop the file by enabling the 'copy previous results to parameter' and 'execute for every row' will run for every single row. Check the image below:
Finally when writing the files in an excel file (using Excel Writer Step) make sure that every time a row is coming from prev. step is getting inserted into the same file. Check the below image for this.
I have uploaded a sample code in github. Hope it helps :)
Im wondering if this is possible with excel. I have a list of employees with multiple columns counting up their production in my company. It is a list of about 40 names and has about 10 columns of different tasks that are counted up to determine productivity. these people are split up into different teams and i have their names tagged with the team. For example, if joe smith was in customer service, his name says CSR-Joe Smith. I want to be able to use this excel sheet over and over again so i can simply run this master report and put the data into one sheet to populate a different sheet for each team. Is there a way to do this by looking at the team tag i add to each persons name and extract from the list of employees the team members that are on the same team? Im working on excel 2010 and have some knowledge of VB and C coding in excel but not a ton of experience with it. I also want to pull the values for each team member in each column.
here is an example if my words didnt make sense, each employee has a row like this.
name status1 status 2 status 3 status 4 status 5
CSR-Joe Smith 251 358 12 58 9
I should mention that this data is gathered from a SQL query that i want to pull out of MS SQL management studio and am copying into excel.
To sum it up, my solution for this kind of problem and related:
Solve database-problems in a database, whenever you can ;)
It is far more easy to make joins, selection and filtering inside a database, than inside excel.
If you have to do it in excel, see if subsum, pivotTable or vlookup can help you, because those could most likely do.
Be alarmed, when you start trying to solve database-problems with vba - usually there are better ways, or at least there should be. When you have a good datasource - like sql - it should definetly be your first attempt to get create a better view or table in sql.
Additionlly, you can use .odc connection-files with excel directly. By opening one, you create a new Workbook and you will open your connection as a worksheet.
The goal of my project is to create an out of office program that will allow easy tracking and auditing of our Sharepoint site as it doesnt have a built in system to do. I have no background in VBA, but I have done quite a bit of python. That being said I've ran into my first issue. I'm not sure how the syntax works, and what commands I should be using to get the results I want. I.e. sheets vs worksheet vs worksheets.
I have a workbook, 1 sheet is Raw Data, in which I import data from a sharpoint site. It displays the following columns
Resource Name -- Absence Type -- ID -- Start Time -- End Time -- Created -- Modified by
The next sheet I have is tracking, it's called Tracking. On this page the user imputs Resource Names they want to track into Column A, and then the remainign columns are going to display the number of absences that name has so it will look something like
Resource Name -- Vacation -- Sick -- WFH
Clooney, George -- 2 -- 0 -- 7
A counter will run based on each instance that appears in raw data and adds the number to the counter based on the absence type from raw data.
I need a way to loop through Raw Data and look for the names that appear in the Tracking data. If Possible I'd like to store them in a third worksheet jsut for testing purposes. I know the logic I need to use, but what I dont know is the syntax to refrence the pages together. Any insight on the best way to accomplish this?
Question : I need to Search raw data for every instance Resource Name appears in it from the Tracking page and store into another worksheet.
If you don't want to use PivotTables (can be hard to search later) this is the way to do it with COUNTIFS. This formula goes in the "Sick" column of Tracking in row 2 (assuming row 1 is headers).
=COUNTIFS('Raw Data'!A:A,Tracking!A2,'Raw Data'!B:B,"Sick")
It assumes that in Raw Data Name is in column A and AbsenceType is in Column B, but it doesn't matter how many records there are.
The way I understand your question (and it wasn't easy), you are dealing with a bunch of timesheet info. You seem to be trying to count the number of instances of different kinds of time off that people are taking - whether that be vacation, sick or working from home(WFH).
I've never heard someone's name referred to as a "Resource Name" lol.
You really don't need to use VBA for this problem - at least not anything that you can't just record a macro for - it seems to be a rather simple problem that can you solve using a pivot table.
If you want to you can set up a vlookup reference to this pivot table to create the little form that you seem to be trying to create. But really I think your better off just teaching whoever is going to be using this about pivot tables. Let me know if I misunderstood your question and I'll be happy to delete this post.