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.
Related
I have a question about SQL. I want to rename my column when I extract them to Excel with ODBC. My column name are encoded but there is a table that allow me to translate them. Is it possible to display my request with modified column name in order to read them more easily.
Table A
MMCONO
MMSTAT
MMITNO
300
20
110599V0
300
20
058867CAP9
Table B
Code
Label
MMCONO
Company code
MMSTAT
Item status
MMITNO
Item number
Expected display for the extract
Company code
Item status
Item number
300
20
110599V0
300
20
058867CAP9
Can you help me please ?
Thanks in advance :)
I think that a junction could help me or a lookingV in Excel but it would be better if it's native SQL.
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]]
I have Five columns.
E.g.
Column1: Name
Column2: surname
Column3: mapping
Column4: Mapped data
Columns contain data like
Name Surname Mapping Name1 Surname1
1 ABC 1 AAAA 3 ABC QQQQ
2 XYZ 2 XXXX 1 XYZ AAAA
3 OPQ 3 QQQQ 4 OPQ RRRR
4 RST 4 RRRR 2 RST XXXX
Now my aim is to map name column to surname by using mapping column and result should be stored at Name1 and Surname1 column. I have more data in Name and Surname column, by writing number in Mapping column it will automatically map the surname to Name (the choice is given to user for entering number in mapped column then map the data accordingly) and result should be copied in Name1 and Surname1.
I am not getting any idea to achieve this using VBA. coding Plz help me.....
Amar, there are certainly plenty of ways to go about this using Excel's built in functions, however, since you asked about a VBA solution, here you go:
Function Map(n)
Map = Cells(n + 1, 2)
End Function
Placing the above code into the VBA editor of your project will allow you to use this custom function in the same way you would any of Excel's builtin functions. That is, entering =Map(C3) into any cell should give you the result you're after (where C3 is the cell containing your mapping number). The function works by returning the data in [row n (defined in your mapping column) +1 (to account for the header row); column 2 (the column containing your surname)]. The data in column "Name1" will always be the same as that in column "Name" (so it seems). So the function in your "Name1" column would simply be =A2
If this does not solve your problem, or you need further guidance, please let me know.
Supplement
#Amar, the comment by #freakfeuer is spot on. VBA is really overkill for something as simple as this and, as he points out, portability and security are both significant drawbacks. Offset is a fine alternative.
I am new to VBA and from what I have seen it will be the best way to go about doing what I want to do. I have an excel spreadsheet with Column A being the name of a company and Column B being the state which it is in. Since companies are in multiple states there are repeated company names, I would like to make it so that Column B has a list of the states so that Column A does not repeat. I know that similar questions have been asked but like I said I am new to this and have never used VBA before so some of the code without an explanation is not all that helpful.
For example I would like to go from:
Company 1 | MI
Company 1 | IA
Company 1 | MD
Company 2 | MI
Company 2 | OH
To this:
Company 1 | MI, IA, MD
Company 2 | MI, OH
Any help would be greatly appreciated or suggestions of ways other than VBA would be appreciated.
I suggest you put both columns in the ROWS area of a PivotTable and ensure that has no subtotals and is in tabular format.
You may not need vba at all. One way to get the results you want is to put the following equation in Column C (assuming Company is in A and States are in B):
"=IF(A2<>A1,A2,"")"
Without the outside quotes. Then just drag the formula to fill to the bottom of the data. Also, if you use this formula, start the data on A2, as the formula will look at the cell above.
The D column is simply =B2.
The VBA code will follow this logic as well, if you still want to use VBA.
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