Find unique values from multiple different col in a every row - excel-formula

Apologies, I have no code because I am not quite sure where to start...
I need to find all the unique countries code from 6 different columns shown below and append them at the end in the Indicas.
For example:
Residence 1
Residence 2
Residence 3
Mail 1
Mail 2
Mail 3
Indica 1
Indica 2
Indica 3
CN
US
NULL
US
CN
NULL
US
NULL
NULL
NULL
NULL
NULL
US
CN
EU
NULL
NULL
NULL
To fill the Indica to be like this:
Residence 1
Residence 2
Residence 3
Mail 1
Mail 2
Mail 3
Indica 1
Indica 2
Indica 3
CN
US
NULL
US
NULL
NULL
CN
US
US
NULL
NULL
NULL
NULL
NULL
US
US
CN
NULL
NULL
NULL
EU
US
CN
EU
It looks deceptively easy yet I'm struggling hard with it.

I have placed the table in B1:J4. you can use the following formula in all indica cells
=IF(UNIQUE($B3:$G3,TRUE)="NULL","",UNIQUE($B3:$G3,TRUE))

Related

Given 2 columns (A,B), how to filter column B based on values in column A?

I have an excel spreadsheet that looks similar to the table below:
A
B
Null
Null
Null
Null
To
John Doe
CC
Jane Doe
To
Null
CC
Null
I want to filter the table so that rows that have a value in A but Null in B do not show, similar to table below:
A
B
Null
Null
Null
Null
To
John Doe
CC
Jane Doe
Use:
=FILTER(A1:B6,NOT((A1:A6<>"Null")*(B1:B6="Null")))

substitute a value in a cell with its class, Excel

I got two Excel database. One, regarding only cities and their land, has two main columns:
database1
city land
1 1
2 1
3 2
4 2
The other database shows observations and the city where they happened.
database2
- city
observation1 4
observation2 3
observation3 1
observation4 1
I'd like to substitute each cities with the corresponding land, to get something like that:
- city land
observation1 4 2
observation2 3 2
observation3 1 1
observation4 1 1
How do you think I can achieve that?
solved with xlookup (or cerca.x in italian), I'll show you how:
landdatabase2 =XLOOKUP(citydatabase2;citydatabase1;landdatabase1)
wonderful! thanks everyone

Excel Finding matching values in a column and comparing the values in another column to one another

EDIT I have to accomplish this in Excel 2016 so I don't have access to Unique or Filter Functions
I have a table that contains a list of names and addresses and other information.
I want to identify instances where the street address is used more than once, and then compare all the instances of the street address to return a “Match” or “Alert” if the last names of the people at the address do or don’t match.
I created a CountIf Column to identify entries that need to be compared, and a column to pull just the last name.
=COUNTIF([Street],[#[Street]])
=LEFT([#Name],(FIND(" ",[#Name],1)-1))
How can I compare the last names of everyone living at the same address?
Is there a way to use the Filter function here, or will I need VBA?
ID#s
Name
Last Name
Result
Street
Street Count
1
Brown Bob
Brown
Address 1
2
2
Brown Sue
Brown
Address 1
2
3
Green Adam
Green
Address 2
2
4
Chruchill John
Chruchill
Address 2
2
5
Smith Gary
Smith
Address 3
3
6
Smith Lisa
Smith
Address 3
3
7
Parker Peter
Parker
Address 4
1
8
Parker Lewis
Parker
Address 4
1
9
Smith Evan
Smith
Address 3
3
This formula returns:
Ok if the [Street] is unique (change as required)
Match if the [Street] is not unique and all the [Last Name] for that [Street] are the same.
Alert if the [Street] is not unique and not all the [Last Name] for that [Street] are the same.
= IF( COUNTIF( [Street], [#Street] ) = 1, "Ok",
IF( COUNTIF( [Street], [#Street] )
= COUNTIFS( [Street], [#Street], [Last Name], [#[Last Name]] ), "Match", "Alert" ) )
Try:
Result: =IF(COUNTA(UNIQUE(FILTER([Last Name],[Street]=#[Street])))=1,"Match","Alert")
Edit: If you only have Excel 2016, try:
=IF(COUNTIFS([Street],[#Street],[Last Name],[#[Last Name]])=COUNTIF([Street],[#Street]),"Match","Alert")

Excel : Automate COUNTIF (based on another table)

I have a table that looks like this:
name nation
aaa ESP
bbb FRA
ccc ESP
ddd BEL
eee FRA
fff ITA
I have another table with :
country count
ESP -
BEL -
FRA -
ITA -
I would like my "count" column of the second table to count how many instances I have of that nation in the first table.
So that I get :
country count
ESP 2
BEL 1
FRA 2
ITA 1
I could enter in each cell of the "count" column:
COUNTIF('my 1st table nation column',"name of the targeted country")
The thing is I have 150 countries and I can't possibly edit all the country codes in each and every cell of the "count" column.
I also tried this workaround:
I selected the first cell of "count" and then highlighted the whole column. Then I typed:
COUNTIF('my 1st table nation column',"name of the country of the first country cell")
This way, I expected each cell of the "count" column to refer to the name of the "country" of its table row.
But it didn't work.
Is there any other way (with a formula, not VB) I can automate the process so that each "count" cell reads its "country" and swipes through the "nation" column and count how many instances there are ?
Thank you.
=COUNTIF($B$2:$B$7,"="&D2)
name
nation
country
count
aaa
ESP
ESP
2
bbb
FRA
BEL
1
ccc
ESP
FRA
2
ddd
BEL
ITA
1
eee
FRA
fff
ITA
Use a Pivot Table, field nation into rows section and field name into values section.
That way you can make a list of unique countries and count how many instances of each you got in like 3 seconds....
Create a PivotTable to analyze worksheet
data
No need of VBA.

Case Else Statement from different tables

I am trying to retrieve a name based on a certain type of claim. Would seem easy enough, but it's not working for me. I am working with 2 main tables, claim and exposure, and a contactname table. Each claim can have multiple exposures, but each exposure can have only one claim. Both tables contain a nameID field - claim.nameID and exposure.nameID. The nameID correlates to ContactName table.
Contact Name
ID Name
111 Jim
222 Bob
333 John
444 Sam
555 Walt
Normally, each claim can have multiple exposures and the exposures on a claim can have the same name or different names. The name ids are found on the exposure.
The exposure.nameID joins ContactName.ID
Claim claim.nameID ExposureNo exposure.nameID Name
A null 1 111 Jim
A null 2 222 Bob
A null 3 333 John
B null 1 444 Sam
B null 2 444 Sam
Workers comp claims are different. Each workers comp claim can have multiple exposures, but all the exposures have the same name. Since the exposures on a claim have the same name, the name ids are found, not on the exposure table, but the claim table. Go figure… The claim.nameID joins ContactName.ID AS ClaimContactName.
Claim claim.nameID ExposureNo exposure.nameID Name
C 111 1 null Jim
C 111 2 null Jim
C 111 3 null Jim
D 555 1 null Walt
D 555 2 null Walt
I can get the names for non workers comp claims and can get the names for workers comp claims. However, when I put the 2 queries together, I don’t get any results.
Select
CASE WHEN #Select(Claim\Policy Type) = 'Workers'' Compensation' THEN
CASE WHEN ClaimContact.Name IS NULL AND ClaimContact.Name.FirstName IS NULL THEN ClaimContact.LastName
WHEN ClaimContact.Name IS NOT NULL THEN ClaimContact.Name
ELSE ClaimContact.FirstName + Space(1) + ClaimContact.LastName END
ELSE
CASE WHEN Contact.Name IS NULL AND Contact.FirstName IS NULL THEN Contact.LastName
WHEN Contact.Name IS NOT NULL THEN Contact.Name
ELSE Contact.FirstName + Space(1) + Contact.LastName END
END
Haven’t done much of this, but could really use the help to figure this out. Thank you in advance.
This was for an SAP Universe using Information Design Tool. I ended up creating a derived table that gave me exactly what I needed, including learning something new along the way.

Resources