i have two tables
one includes dates (table1)
Date
11/10/2019
11/17/2019
the other one has names (table2)
Name Surname
xxxxxx
yyyyyy
i want to combine the second table for each data in the table1
result should be
Name Surname Date
xxxxxx 11/10/2019
yyyyyy 11/10/2019
xxxxxx 11/17/2019
yyyyyy 11/17/2019
i am sure it is very for you guys,
thanks for the help,
It's quite easy:
= Table.Join(table2,{},table1,{})
Related
I have the following two Access tables
Employees
id Name
1 bob smith
2 james bird
3 jane big
Events
id emp_id Notes
1 1 fell down the stairs
2 3 paper cut in the break room
I also have the following Excel file that I would like to 'suck' (import) into the Events table. The problem is the data needs to be correlated on the name/emp_id field and I'm not sure the best way to do this.
Excel_sheet
Employee Name Notes
bob smith feel asleep while driving
The access table uses references to the Employees table, whereas the Excel sheet is using names. What are some options for me to bring this Excel sheet into Events table and convert the names (bob smith) into their associated id's from the Employees table?
Assuming names are consistently spelled in both datasets and only one person exists for each name, try:
INSERT INTO Events(emp_ID, Notes) SELECT ID, Notes FROM excel_sheet INNER JOIN Employees ON Employees.Name=excel_sheet.[Employee Name];
Build that SQL in a query object or run in VBA:
CurrentDb.Execute "INSERT INTO Events(emp_ID, Notes) " & _
"SELECT ID, Notes FROM excel_sheet " & _
"INNER JOIN Employees ON Employees.Name=excel_sheet.[Employee Name];"
Suggest you test with a copy of database.
Name is a reserved word and really should not use reserved words as names for anything.
I'm looking to try do the following;
I want to have say 3 columns.
Transaction | Category | Amount
so I want to be able to enter a certain Name in Transaction say for argument sake "Tesco" then have a returned result in Category Column say "Groceries" and I can enter a specific amount then myself in Amount Colum.
Thing is I will need to have unlimited or quite a lot of different Transactions and have them all in pre determined Categories so that each time when I type in a Transaction it will automatically display the category for me.
All help much appreciated.
I know a simple If Statement wont suffice I can get it to work no problem using a Simple IF Statement but as each Transaction is different I don't know how to program further.
Thanks.
Colin
Use a lookup table. Let's say it's on a sheet called "Categories" and it looks like this:
| A | B
1 | Name | Category
2 | Tesco | Groceries
3 | Shell | Fuel
Then, in the table you describe, use =VLOOKUP(A2, Categories!$A$2:$B$3, 2, FALSE) in your "Category" field, assuming it's in B2.
I do this a fair bit using Data Validation and tables.
In this case I would have two tables containing my pick lists on a lookup sheet.
Transaction Table : [Name] = "loTrans" - with just the list of transactions sorted
Category Table : [Name] = "loCategory" - two columns in table, sorted by Both columns - Trans and Category
Header1 : Transactions
Header2 : Category
The Details Table:
the transaction field will have a simple data validation, using a
named range "trans", that selects from the table loTrans.
the transaction field will also use data validation, using a named
range, but the source of the named range ("selCat" will be a little more
complex. It will be something like:
=OFFSET(loCategory[Trans],MATCH(Enter_Details!A3,loCategory[Trans],0)-1,1,COUNTIF(loCategory[Trans],Enter_Details!A3),1)
As you enter details, and select different Transactions, the data validation will be limited to the Categorys of your selected transactions
An example file
I have rawdata with only ID's and dates of transactions. Then I have a list of people; their ID, their hire date and their name.
What I want is a column in the rawdata that gives me the persons name. The problem is, that the ID is re-used if the person quits, and another one starts.
Since I have the transaction date, I figure it should be possible to check:
IF the transaction matches the period they were hired, then get the right name.
Is this possible, and then how?
Rawdata:
Column A = Transaction date
Column B = ID
Column C = Here I want their name
People list:
Column A = ID
Column B = Name
Column C = Hire date
Example (Excel Online - can be edited):
https://1drv.ms/x/s!AjWVkb2UBexjhzAKMy-YiE5EoKwc
Screenshot:
Make sure your reference table is ordered in chronological order oldest to newest:
=INDEX(F:F,AGGREGATE(14,6,ROW($G$8:INDEX(G:G,MATCH(1E+99,E:E)))/(($E$8:INDEX(E:E,MATCH(1E+99,E:E))=B8)*($G$8:INDEX(G:G,MATCH(1E+99,E:E))<A8)),1))
I had to name your tables People and Raw_Data to use structured table references in the formula. Additonally, I added some data and changed a few dates.
=INDEX(People[Agent Name], AGGREGATE(15,6, (ROW(People[Personal ID])-ROW(People[[#Headers],[Agent Name]]))/((People[Personal ID]=[#[Personal ID]])*(People[Hire date]=AGGREGATE(14, 6, (People[Hire date])/((People[Personal ID]=[#[Personal ID]])*(People[Hire date]<=[#[Transaction date]])), 1))), 1))
I have this data in excel
I have a spreadsheet with data like this:
Username GroupName Output
jsmith 1234 jsmith1234
mdean 2345 jsmith2345
kjack 3456 jsmith3456
4567 jsmith4567
mdean1234
mdean2345
mdean3456
mdean4567
kjack1234
kjack2345
kjack3456
kjack4567
I want to know if there is a function to create the output based on this set of data. The Username could be more than GroupName or vice-versa.
Try
=IF(ROW()-ROW($C$2)+1>COUNTA(A2:A)*COUNTA(B2:B),"",INDEX(A2:A,INT((ROW()-ROW($C$2))/COUNTA(B2:B)+1))&INDEX(B2:B,MOD(ROW()-ROW($C$2),COUNTA(B2:B))+1))
Pulled from: http://www.mrexcel.com/forum/excel-questions/654871-how-generate-all-possible-combinations-two-lists-without-macro.html
I've got a table in access looking like this,
Category | Subcategory | Userdate (mm/dd/yyyy) | Color
I want to export this to an excel file where the Categories and Subcategories will be placed in column A and B respectively. However the Colors will be placed by month (Userdate), 12 months meaning Columns from C to N. So what I want to do is place the records from colors in different columns depending on the month (Userdate).
What is the best way to go about doing this? Create a recordset and loop through it? I reckon this will be a bit slow when rows exceed the 40k which is possible.
I could also make the table have Month columns like:
Category | Subcategory | January | February | etc...
So I could just export it just like that but seems to me that's just a bad way of making a table.
it sounds like you want a crosstab query:
TRANSFORM First(Table1.Colour) AS AColour
SELECT Table1.Category, Table1.Subcategory
FROM Table1
GROUP BY Table1.Category, Table1.Subcategory
PIVOT Format([Userdate],"mm-mmm");
You can transfer to Excel programmatically with DoCmd.TransferSpreadSheet