I need to check whether a row from one table in one spreadsheet contains the same values for certain columns in another row in a table in a separate spreadsheet. This is going to be used for data validation.
For instance, I need to confirm that the item in row 2 of Table 1 has the same PO Number and Date of the item with the same Item Number (row 2) in Table 2.
I have included a link to an image containing the sample tables:
What is the best approach in tackling this problem? This is a simple representation because there are typically over 200 rows to be validated.
Related
I have a data table which has 3 columns . I am populating the values of each column separately in a loop which causes the table structure to be in the format as shown in the image. How to clear every column at the beginning of the loop so that all data comes in a proper tabular format. In short I want to have a data table with variable number of rows possible for each column.
To clear every column at beginning of the loop you have two options:
loop all rows
remove column, add column
Depending on the plenty of rows the two options have different performances.
For large amount of rows i prefer the second option.
I have a table of data in Excel. Column A contains Names, Column B contains their interest. Each interest has a separate row. I want to take the data from this table and have a single row with the name of the customer and a column for each of their interests. IE RAW Data:
I am looking to take the 4000 row table and grouping by the name. I am unsure how many times each name appears in the list (Once or Fifty times) but I want the interests placed on a single row with each interest in a separate column EG Desired Data:
I have tried the standard transpose....html table....and pivot tables but it will put the interests all in a row along the top regardless if the customer is interested or not and using a record count T/F that means the data sheet in harder to understand then if I leave it as one block and sort by name
Sure I am not alone with this but all searches for the past 2 hrs keep returning pivot/transpose or duplicate items. Any is appreciated
If you don't want to use VBA, you could first add a column, for instance in column C, with the title "InterestNum."
In C2, just put 1.
In C3, put =COUNTIF($A$2:$A2, $A3) + 1. This will find the number interest it is for the person.
Make a lookup column, for instance in column D. In D2, put =A2&C2
Then, make a list of all the people. I assume that you put this list starting in cell A2 of a new sheet. Then put headers starting in B1 so that B1 contains the title "1" and C1 contains the title "2" standing for the interest number and as many columns as you wish.
Then in Cell B2, put the formula =IF(ISNA(MATCH($A2&B$1,data!$D$2:$D$5,0)),"",INDEX(data!$B$2:$B$5,MATCH($A2&B$1,data!$D$2:$D$5,0)))
This assumes that your original data is in the data tab. I only tested with 4 rows, so you would need to change $D$2:$D$5 to have as many rows as you do. This works by looking up a combination of the name and interest number. It first checks to see if that combination exists in the data. If not, it leaves that interest blank. If so, it finds the actual interest by going to the same row of the lookup.
First remove duplicates using standard excel functionality to prevent having the same interest twice for a person.
Now, you could of course use VBA and perform exactly what you need.
However, I suggest that you use the pivot table.
If your data looks something like this...
... just use "Insert | Pivot table" and insert a pivot table to a new worksheet.
Then, configure the columns as follows:
Et voilĂ , there you have all your interests listed only once and if a person shares an interest, there is a "1".
If you would rather use VBA, just comment and I will edit my answer.
I have the following table layout in an Excel data table (fed by a SQL query):
Name, Birthday, Children, Check In
The first three columns come from a database query, the Check In column should be a column where I can manually enter an x for example.
Now, when I refresh the data table, the entries in the last column should stay in the right row. Currently, when I refresh the table the entries stay in the very same row they were entered in (e.g. if you enter an x into row 4, refresh and row 4 becomes row 5, the x stays in row 4).
Is there a way to avoid this?
Thanks in advance!
Hopefully you have some ID that uniquely identifies each item in each row (you could use the Name column if you don't have duplicate names). Keep a copy of your old data that you have marked the "Check In" box for. Then do a basic VLOOKUP to see whether that name has check in.
Happy Holidays. I have two dependent tables, [orders] and [reviews], linked by a "one to many relationship". On the [Orders], the PK is [Order#], there is a column for [#_of_reviews_ordered]. On the [reviews] table (the PK is an auto number) the linked field is [order#] and the number of records (records on the table) should equal "[Orders].[#_of_reviews_ordered]".
Is there a simple way to accomplish this without having to do add the records to [reviews] manually?
The only way I can think to do this without VBA is fairly convoluted and would only work if your number of reviews orders fits within a finite (and reasonably small) range. For my explanation I will assume # of review will be between 0 and 3
You would need to create a table called, say, TemplateReviews. This would have at least one field called "KeyNumber", which should not actually be a key. You could also repeat as many fields as desired from Reviews, and use them to store default values for the rows to be inserted.
The important thing about TemplateReviews is that you must set it up in advance to have N rows with KeyNumber=N for each possible value of KeyNumber. For my example, we can have 0 to 3 # of reviews. So TemplateReviews will have:
0 rows with KeyNumber=0
1 row with KeyNumber=1
2 rows with KeyNumber=2
3 rows with KeyNumber=3
Once you have TemplateReviews set up, you need to create an Insert query based on it. The query will insert rows from TemplateReviews into Reviews. But you also have to filter KeyNumber to match the value on the currently selected Order, as in
=Forms!Orders![#_of_reviews]
You then need run Insert query to run using a macro triggered by a button (etc) on the Orders form. This only works the first time you click the button... but you can modify the criteria expression above to subtract the number of existing reviews, as in
=Forms!Orders![#_of_reviews] - DCount("*","Reviews","OrderId=" & Forms!Orders![order#])
Hope this helps. If you got this approach working, you could then replace the button with a single line of VBA code in the Order form AfterUpdate event to trigger the insert query.
I have a SQL database that uses MS Access as a front-end and is coded with VB. Data is imported daily from an Excel spreadsheet in the form:
Journal Date, IO Account, Amount, Posted Date, Line Description, User ID, Date Checked, Voucher
The Voucher data is formatted in the Excel spreadsheet like:
1111111;2222222;3333333
The Voucher can have as many voucher numbers as needed (anywhere from 1 - 13 different num bers usually) and each number is separated by a semi-colon. Also, each number can differ in physical length. I then need to link these voucher numbers to multiple different tables. The data structure that was in place when I took over this project stored the voucher in the semi-colon separated form and parsed the string to link to other tables. I'm getting ready to revamp this database, and I don't want to store the data like this format because I know it violates 1NF.
I know I should probably use foreign keys, but I'm not sure how with the varying Voucher data. I have the ability to parse the data any way possible with VB in Access when it comes from Excel, I just don't know how to store it to relate my tables.
The goal of the project is to match everthing that relates to each distinct voucher and see if the amounts match up. Right now the process takes anywhere from 5 - 10 minutes to split the vouchers and compare the data across tables.
Let me know if you need more information. Any advice would be appreciated.
Thanks!
EDIT- Let me be more clear:
Here is an example voucher: 2988670;2990020;2989130;2991597;ONL112382
There are multiple entries in the table (call it T1) with this voucher with differing amounts. Each of the numeric values (excluding ONL number) correspond to another table (call it T2). If each of these 4 numbers are in T2, they are said to be "Matching". If they are matching and the sum of the amounts in T2 equal the sum of the amounts in T1, they are "Matching with no difference".
Sometimes the voucher looks like this: ED414596
In this case, I have to compare this value to a completely different table (call it T3). It includes the same matching process as above.
*Let's just say the voucher comes across in multiple ways and it needs to be compared to multiple tables.
Your voucher table would have a voucherID and a voucherNumber, this would allow voucherID to be repeated as many times as necessary. voucherID would be a foreign key from your first table, and the two columns together would be the PK for this table.