Excel: How to update multiple tables at the same time - vba

I have these 2 tables in two different sheets in excel. They both have common tabs but the only one I am concerned about is the student ID. What I would like to do is make changes to the student ID in the first table and have it reflected in the second tables student ID for data consistency. I am working in excel 2010 and everything I have researched is for later versions of excel. I have tried the special link technique but because these are 2 tables it does not work. The special link option does not appear. I am not sure if I need a script to do this or if excel 2010 has a built in way to do this.
First Table:
Student ID Last name Initial Age Program
STF348-245 Another L. 21 Drafting
STF348-246 Different R. 19 Science
STF348-247 Name G. 18 Arts
STF348-248 Going L. 23 Nursing
STF348-249 Up M. 37 Science
STF348-250 And J. 20 Arts
STF348-251 Down F. 26 Business
STF348-252 Different S. 22 Arts
STF348-253 Different W. 20 Nursing
STF348-254 Different L. 19 Drafting
Second Table:
Student ID Last name Initial Age Program
STF348-245 Another L. 21 Drafting
STF348-246 Different R. 19 Science
STF348-247 Name G. 18 Arts
STF348-248 Going L. 23 Nursing
STF348-249 Up M. 37 Science
STF348-250 And J. 20 Arts
STF348-251 Down F. 26 Business
STF348-252 Different S. 22 Arts
STF348-253 Different W. 20 Nursing
STF348-254 Different L. 19 Drafting

With the exception of inserting or appending new rows, this can be accomplished using the VLOOKUP function only, assuming the Student ID field is a unique identifier.
In the "Program" field of Table2, put:
=VLOOKUP([#[Student ID]],Table1,5,False))
Copy/Drag the formula down. Now any changes to Program on Table1 will be reflected in Table2.
Follow the same procedure for other columns, simply using the appropriate header name as the first argument to the function, and making sure to also change the column Index (5 in the above example).
NB: This assumes the "first" table is named "Table1" -- if not, modify the formula accordingly.
If you want to preserve the tables as strict duplicates of one another, including order, then you don't even need VLOOKUP. In Table2, just do:
Student ID | Student Name | Last Name
=Table1[#[Student ID]] | =Table1[#[Student Name]] | =Table1[#[Last Name]]

Related

Create a list from Table

I managed to enter data to a database via a form;
actually works like a charm.
Now, what I need, is a lookup function (preferably not a form), with which I can search a table on another worksheet.
Let's say, I have an edit field or a cell, in which I enter a term which shall be looked for in a certain column on the table in another worksheet.
I would like to get a list of all entries which contain the word and the value from another cell (an ID).
Example:
Search term: Tom
Table:
Tim | 2
Tom | 3
Tommy | 5
The List should Show Tom and Tommy and their respective IDs,
but everything I tried didn't turn out as intended (mostly didn't work at all)...

Excel 2013 VLOOKUP() based on multiple criteria, retrieving multiple rows

I have an issue that can (I believe) be solved by just excel, and may won't require VBA (I could be wrong). I believe it can be solved by nested functions but the formula I've tried has not worked.
Here's my data:
Name Report # Name
Mark Doe ReportXXX Mark Doe
Connie Doe ReportYYY Connie Doe
Debbie Doe REPORTYYY Debbie Doe
Valerie Doe FSMVALTR1 Valerie Doe
Jeff Doe FSMVALTR1 Jeff Doe
Andy Doe RAZXYBCA1 Andy Doe
Ryan Doe RAZXYBCA1 Ryan Doe
Andy Doe RAZ111111 Jill Doe
Ryan Doe RAZ222112 Amanda Doe
This list goes on for about ~4000 rows in the first NAME and REPORT # columns. In the second NAME column I have ~160 rows.
The second name column identifies all the users who actually use the report, with no duplicates. The two name and report # columns have many duplicates, since users have access to multiple reports, and many of them are the same report used for different purposes. Since the second NAME column has so few rows, the names don't match up all the way through, which can be observed near the bottom of both the NAME columns.
What I need to do is have a VLOOKUP that identifies the name in both of the columns and then returns the report number that each individual has access to across rows (horizontally), not down the columns. It also needs to I.D. numerous reports since individuals have access to anywhere from 1-15 reports, starting at the second and so on after the previous has been extracted.
Ideally it would look something like this:
Name Report # Name ex column ex column ex column
Mark Doe ReportXXX Mark Doe ReportXXX ReportAAA ReportB
I didn't list the other reports "Mark Doe" has access to and these would be somewhere down the long list of ~4000, along with his name repeated multiple times in the first NAME column, but the second "unique" name column would be where it is returning the reports to, across rows.
I made a method that uses additional three columns and it worked for me.
I used the data you provided above.
Add three columns to the left.
in A2 enter =COUNTIFS($D$2:$D2,D2,$E$2:$E2,E2).
in B2 enter =SUMIFS($A$2:$A2,$A$2:$A2,1,$D$2:D2,D2).
in C2 enter =D2&B2.
Now copy those cells to all your 4000 rows.
Now next to the second name column add column headers numbered from 1 to as many reports you think can be the max one user can have (you said 15).
Now enter this vlookup in F2 =IFERROR(VLOOKUP($F2&G$1, your table array starting from column C as absolute/fixed ,3,FALSE),"") in my case it was =IFERROR(VLOOKUP($F2&G$1,$C$2:$E$11,3,FALSE),"").
Copy the formula accross all columns with number headers and down all rows that have names in second name column (160).
your sheet shuld look something like this image
All the best let me know if it worked for you.
Have you explored the option of using a Pivot Table?
The output would look like this:
With the Pivot Table setup like this:
This method would make for a cleaner view, as your current method looks to repeat ~4,000 times (once for each report & name combo). Hopefully this works for what you need.

Excel VBA create columns and populate with data based on another column

Okay so I have to create two new columns and populate it with data from another worksheet if the values for another column matches. I'll break it up to make it easier to understand. There are two worksheets namely; "JULY15Release_Dev status" and "JULY '15 Rel".
Both of these worksheets have a header of "eRequest ID" for column A. I need to create two new columns for "JULY15Release_Dev status" and populate it with data from "JULY '15 Rel" if the "eRequest ID" matches for that specific row of data.
By creating two new columns and populating it with data, it doesn't necessarily have to be "creating then populating", copying that exact 2 columns is also fine, so long as the data remain intact. The data will be in date/time format if it affects anything. Thanks in advance for any help as I'm a total beginner at this!
Let's say, before we do VLOOKUP, our JULY15Release_Dev status sheet looks like this:
A B C
1 eRequestID FirstName Lastname
2 10
3 30
JULY '15 Rel looks like this:
A B C D ....
1 eRequestID FirstName Lastname Age
2 10 Jon Smith 40
3 20 Matt Kahn 50
Our task is to get FirstName and Lastname from JULY '15 Rel into JULY15Release_Dev status.
After adding VLOOKUP in JULY15Release_Dev status, the sheet looks like this:
A B C
1 eRequestID FirstName Lastname
2 10 =VLOOKUP(Sheet1!A2,'JULY ''15 Rel'!$A$1:$C$3,2,FALSE) =VLOOKUP(Sheet1!A2,'JULY ''15 Rel'!$A$1:$C$3,3,FALSE)
3 30 =VLOOKUP(Sheet1!A3,'JULY ''15 Rel'!$A$1:$C$3,2,FALSE) =VLOOKUP(Sheet1!A3,'JULY ''15 Rel'!$A$1:$C$3,3,FALSE)
Give it a shot and see how it works for you.
Alternate to answer with diagram
=INDEX(Sheet!A:1:1048576, MATCH(A2, 'JULY ''15 Rel'$A:$A,0),[column number])
no data sort necessary
if you want to put it into a macro it is a bit redundant unless used based on other variables or tasks.

How can I merge rows (of a particular column) having the same value in SQL Server Reports RDL?

I'm new to working with SQL Server 2005 Reporting Servives using RDLs in BIDS.
I need to modify an existing report so that I can merge cells in adjacent rows which would have the same value for that particular column.
Ex: consider this is the table returned from the stored procedure used by the reports RDL.
_________________________________________________
Id SubCategory Field1 Field2 Total
_________________________________________________
1 a Bob US 17
1 b John UK 17
2 a Mary AUS 12
3 d Ram IND 19
4 b Alex UK 09
4 c Abby FR 09
5 e Tim IT 03
_________________________________________________
Table Example - Couldn' Format Text :( Image here : http_://i.stack.imgur.com/gWEH5.png_
What I need to do is I want the cells merged into one where two adjacent rows in the same column have the same value.
Like Id 1 is repeated twice, so the cells for these must be merged. (Also 4)
Similarly for the last column Total for cells with Ids 1 and 4 must be merged.
The RDL has "TextBox" for columns, I saw some other questions in this forum but were related to Tablix or Matrix, so I thought it would be better if I mentioned it.
I need this merging to be done in the RDL, and this should also be present when exported to Excel.
Hoping someone will be able to help soon.
Change the SQL query to use a group by on ID.
in reporting services drag Id On Row group Of Tablix Upaer than Detail Group
and drag other Fields(except Total) Besid ID and befor vertical dash line In the table.
and drag Total to first cell afte vertical dash line

Table structure of a student

I want a table structure which can store the details of the student like the below format.
If the student is in
10 th standard -> I need his aggregate % from 1st standard to 9th standard.
5 th standard -> I need his aggregate % from 1st standard to 4th standard.
1 st standard -> No aggregate % has to be displayed.
And the most important thing is ' we need to use only one table'. Please form a table structure with no redundant values.
Any ideas will be greatly appreciated......
No friends this is not a home work. This is asked in Oracle interview, conducted in Hyderabad day before yesterday '24th July, 2010',. He asked me the table structure.
He even did not asked me the query. He asked me how I will design the table. Please advice me.
id | name | grade | aggregate
This would do the trick, id is your primary key, name is students first last name, grade is what grade he is in and aggregate is aggregate % based on the grade.
Fro example some rows might be:
10 | Bill Cosby | 10 | 90
11 | Jerry Seinfeld | 4 | 60
Bill Cosby would have aggregate percent of 90 in grades 1-9, and jerry would have 60 in grades 1-3. In this case it is one table and boils down to you managing the rule of aggregation for this table, since it has to be one table.
If this is an interview question, it looks like they would like to check your knowledge on Nested Tables. Essentially you would have one column as roll number, and other column which is a nested table as Class and Percentage.