Cross-referencing values from a reference table with fuzzy inputs - excel

I've got a Microsoft Access database with several tables. I've thrown 2 of those into an Excel file to simplify my work, but either an Access or Excel solution can be used for this. Below are examples of the data that needs to be manipulated, but in those records there's a lot of other columns and information.
I've got Table 1 (Input Table):
| Bank | Reference |
|-----------------|-----------|
| Chase Bank LLC | |
| JPMorgan Chase | |
| Chase | |
| Bank of America | |
| Bank of America | |
| Wells Fargo | |
The Reference column is empty. I want to fill it based on the reference table, which contains the IDs that would go into the Reference column.
Table 2 (Reference Table):
| Bank | ID |
|-----------------|-----------|
| Chase Bank | 1 |
| Bank of America | 2 |
| Wells Fargo | 3 |
So the solution would fill the "Reference" column like this:
| Bank | Reference |
|-----------------|-----------|
| Chase Bank LLC | 1 |
| JPMorgan Chase | 1 |
| Chase | 1 |
| Bank of America | 2 |
| Bank of America | 2 |
| Wells Fargo | 3 |
Since this is taken from a database's table, these aren't really ordered records. The purpose of this is to create a relationship in an already-existing database that didn't have those relationships set up.

a join between the 2 text fields, in an Update query, will provide a write of the ID for those records that exactly match.
there is no technology/option for the non matching; you can only apply some creative designs... for instance the chase bank does match for the first 10 characters... so for the non matched you could set up a temp table with a new field that is Left(fieldname,10)...join on this new field to get the ID into the temp table - - and then do a 2nd Update query to move the ID again finally using the full name

Related

Comparing Power BI/Excel Reports

I'm working on a project where I receive a list in excel of employee names, dates and ID's. I need to compare this list to a Power BI report that I've made to bring back any ID's that are locked.
For example:
I receive
| Employee Name | Date | ID |
| ------------- | --------- | -- |
| John Doe | 4/22/21 | 1 |
| Jane Doe | 4/23/21 | 2 |
The Power BI Report looks like this:
| Employee Name | Date | ID | LOCK? |
| ------------- | -------------- | -- | -------- |
| John Doe | 4/22/21 | 1 | LOCK |
| Jane Doe | 4/23/21 | 2 | UNLOCKED |
Is there a way to compare a my list in excel with my a Power BI on a large scale? I've tried Power Query in Excel, but the data is too large.
Ended up using a pbiviz file (Filter By List)

Find values in list and increment country count

I have a list of email addresses and countries on one tab, eg below.
| Email | Country |
| ----- | ------- |
| user#domain.com | United States |
| anotheruser#domain.com | United Kingdom |
| yetanotheruser#domain.com | United States |
| user3#domain.com | France |
I want to paste a list of email addresses in another tab to be compared to the list above and where the email address from the second tab is found in the first table, have a count on countries on another tab, for example.
| Country | Count |
| ------- | ----- |
| United States | 2 |
| United Kingdom | 1 |
| France | 1 |
I hope this makes sense. How would you go about it? Thanks!
I assume that the first table is on sheet1 and you want to show the 2nd table in sheet2.
For instance, if we want to find the frequency of "United States" in tab 2 which is sheet2, =COUNTIF(sheet1!B1:B10,"United States")

Using IF AND to calculate based on one or more criteria

Within a resource planner, my data has a row for each employee, and columns detailing the team they work for. Another column details the available days they will work in the year. The teams are also displayed along a row at the top, see below :
A | B | C | D | E | F | G |
1 Employee | Team 1 | Team 2 | Days | Finance | Risk | IT |
2 Employee 1 | Finance | | 170 | | | |
3 Employee 2 | Risk | Finance | 170 | | | |
4 Employee 3 | Finance | | 170 | | | |
5 Employee 4 | IT | Risk | 170 | | | |
6 Employee 5 | IT | Finance | 170 | | | |
I want to use columns E:G as a supply calculator per team. Therefore, the formula in cell E2 would be "=IF(B2=E1,D2,0)" and copied along the row, returning the 170 days under Finance and 0 under the rest.
The issue lies where an employee divides his time between two different teams. As you can see, some employees can work for 2 different teams (Employee 2 works for both Finance and Risk, for example). The formula in E3 would therefore need to be some kind of IF AND, where if a value is present in the Team 2 column (C), the value in the Days column (D) would be divided by two and split across the relevent team columns.
I've tried a few options, IF AND, nested IFS etc but cant seem to get the syntax correct. Any help greatly appreciated.
=IF(ISNUMBER(MATCH(E$1,$B2:$C2,0)),$D2/COUNTA($B2:$C2),0)
You actually want OR and COUNTA:
=IF(OR($B2=E$1,$C2=E$1),$D2/COUNTA($B2:$C2),0)

VLOOKUP to merge two tables into one

I have 2 price lists from 2 different companies but there are some many similar item numbers, is there a code to merge the pricelists into one? below example of what I have.
A-Pricelist
Item | Product | Price
382101 | Truck | 130$
212012 | car | 80$
B-Pricelist
Item | Product | Price
111011 | Airplane | 500$
382101 | truck | 50$
Expected result
Item | Product | A Price | B Price
382101 | Truck | 50$ | 130$
212012 | car | 80$ | -
111011 | Airplane | - |500$
I have seen it is done by Vlookup, but it is just not working for me, thanks.
So, vlookup will work fine, I would think about how to control the list of unique values using a dropdown...
But here is an example, updated to deal with missing prices:

What algorithm to use to exchange data between multiple parties

Let's say there are Alice, Bob, Eve and Arbitrator.
And let's say
Alice has a table of records
| id | pet type | birth date |
|----------------------------------
| 1 | cat | 2010-03-03 |
| 2 | dog | 2011-06-12 |
Bob has a table of records
| id | pet type | color |
|-------------------------------|
| 2 | dog | white |
| 3 | bird | green |
Eve has a table of records
| id | pet type | size |
|--------------------------------
| 1 | cat | small |
| 3 | bird | small |
Now everyone wants to enrich his own data by the neighbor's data with the corresponding id, but without disclosuring this id, for example,
Alice wants her data to be like the following
| id | pet type | birth date | color | size |
|------------------------------------------------------
| 1 | cat | 2010-03-03 | | small |
| 2 | dog | 2011-06-12 | white | |
Bob wants his data to be like the following
| id | pet type | birth date | color | size |
|------------------------------------------------------
| 2 | dog | 2011-06-12 | white | |
| 3 | bird | | green | small |
and so on.
Arbitrator coordinates all the exchange operations between the parties and also matches the data using corresponding encrypted id fields from the dataset of each party, so parties must communicate through the arbitrator, but not directly to each other.
Also arbitrator must be able to ensure that
hash(Alice's id = 2) = hash(Bob's id = 2), hash(Bob's id = 3) = hash(Eve's id = 3)
and so on, but must not be able to recover original identifiers, and also arbitrator must not be able to brute-force the encrypted identifiers (so if talking about some kind of hashes - they must be salted)
To simplify things for Alice, Bob and Eve - they would like to have only a single key to encrypt own identifiers, but this key should be different for each party, i.e.
F1(alive_key(alice_id)) = F2(bob_key(bob_id)) = F3(eve_key(eve_id))
where, F1, F2, F3 - are some functions the arbitrator applies to encrypted identifiers of Alice, Bob and Eve, and these functions does not decrypt the original identifiers, but lead the encrypted identifiers to be the same.
So the question - is there any algorithm that can help to solve such an issue?

Resources