Excel Unique district ID - excel

so I'm working on a spreadsheet with cities and districts. I want to have a unique ID for every city. For example, if in the column D1 we have California, we should have let's say an ID of TEST-001, for New York, TEST-002 and so on. If in a next row of that column we have the same city name, let's say California again, we should again display TEST-001. Do you know how to do that?
California (TEST-001)
New York (TEST-002)
Minnesota (Test-003)
California (TEST-001)
I've tried =CONCATENATE(LEFT(LEFT(M5472;25);2);"-";COUNTIF($M$2:M5472;M5472)) which creates a unique ID for every row.

Few options depending on your version of Excel. If you have ms365 this will spill down:
="TEST-"&MATCH(A1:A4,UNIQUE(A1:A4),0)

Related

How to copy a column from one sheet to another in MS- Excel, with ID as reference

I have 2 sheets in one excel file. I'd like to copy only the team column from sheet 2 to sheet 1. Both sheets have matching ID to relate to each other.
Sheet 1
id
name
address
team
123
Paul
1st street
456
Kyle
2nd Street
Sheet 2
id
name
team
123
Paul
CL
456
Kyle
BSM
And then sheet 1 will now look like this:
id
name
address
team
123
Paul
1st street
CL
456
Kyle
2nd Street
BSM
I don't know where to start. I know though that this can be done in excel, and you can do programming on it. I don't want to manually input it since it's more than a hundred records.
Okay so I am assuming all the headers are in first row. This can easily be done through Vlookup
=VLOOKUP(A2,Sheet2!A:C,3,FALSE)
Put this formula in column team in Sheet1. It will work.
Let me know if you need any further clarification.

Selecting rows of a table from a column of another table

I have a column in "table1.xlsx" with more than 200 IDs.
ID
21321
54646
48949
...
And another "table2.xlsx" with the IDs plus all the information about the people.
Name Surname ID City
John Wayne 54646 Madrid
Mary Jane 11111 Berlin
Julius Randle 21321 Rome
Peter Parker 48949 New York
I would like to extract the rows from "table2" that match with the IDs from "table1". There is an easy way?
"table3.xlsx"
Name Surname ID City
John Wayne 54646 Madrid
Julius Randle 21321 Rome
Peter Parker 48949 New York
Open table1.xlsx, table2.xlsx and table3.xlsx in Excel.
Go to Table1.xlsx. Select column A by clicking on A. Above that Column, you will see a box where cell number typically shows up. Click inside that and type in MyIDs.
Go to table2.xlsx. Create a new field called Matching IDs like so:
In Cell E2, type the formula:
=VLOOKUP(C2, table1.xlsx!MyIDs, 1, FALSE)
Hit enter. This formula means, take C2 (from table2) and find a matching row in table1.xlsx's named table called MyIDs (which is column A of table1). Then, choose the 1st column (which is the only column) from MyIDs. FALSE means do an exact match not an approximate match.
Click on E2. Copy it. Paste it into E3..En. You can drag to copy as well. That'll populate the formula in each cell in E column like this:
Click on sort and filter like this:
Click on Matching IDs dropdown and de-select #N/A
Highlight all rows and cells from the filtered data like so:
Copy. Go to table3.xlsx. Paste. Remove the extra column called Matching IDs at the end in table3.xlsx

Arranging data in Excel

I have data in excel. I need help, to arrange it.
part of the data
I need to write for each product all of the countries where it is sold, separate the countries with " | ", For Example: if a certain product is sold in SPAIN, UK, FRANCE, BRAZIL and RUSSIA the row of this column will show: SPAIN | UK | FRANCE | BRAZIL | RUSSIA.
It's need to be in the same column....
Here is one easy way you could do it if you want to see what you're doing.
Fill column C and D, result will be in D. Column B needs to be sorted.
A
B
C
D
1
Country
Product Code Central
Country List
Formatted List
2
UKRAINE
194
=IF(B2=B1;C1&"|"&A2;A2)
=IF(B3<>B2;C2;"")
If you have a version of Excel that understands both TEXTJOIN and FILTER (the former is the most recent, available in Excel 365) the formula below will return the result you describe.
=TEXTJOIN("|",TRUE,(FILTER(A$2:A$11,B$2:B$11=D2,"None")))
Here A2:A11 has the country names, B2:B11 the product numbers and D2 any value from B2:B11.

Excel - Cross Reference - Different Sheets

I have 3 different sheets for the excel document -- 1. County Lookup by Zip Code, 2. County Recording Fees, 3. ZipCode
What I a trying to achieve is the user will enter the Zipcode on the sheet 'County Lookup by Zipcode' and then it will look for the county name on the 'ZipCode' sheet and then it will grab the Recording Fee off the sheet name 'County Recoding Fees'
Issue is that counties in different states in the US have the same name so it is pulling in the wrong fee amount.
I've tried VLOOKUP with no luck.
Link to sheet --
https://urldefense.com/v3/__https://docs.google.com/file/d/1LwvPLmgL9DUT0aopnuNMYJTzksHT8Xn_/edit?usp=docslist_api&filetype=msexcel__;!!KurxxnpmNnI!ViU4pth0-f26aMXJFfiBzD8ktnisXsL7PC_vfDdWCaLx832109gGj0bx2v8jq6UDv-Eqfg$
The data on the the County Recording Fees tab seems incomplete. For example, there is no data for Los Angeles County. Maybe that is ok?
Also the County Recording Fees seems to have data rows for each city and town in a given county. For example, in the case of zip code 6042, the count_fips is 9003. There are 31 rows on the County Recording Fees with a value of 09003. Maybe that is is ok, too?
All that said, you can use nested XLOOKUPs to find the data you want.
I put my formulas in row A4 on the County Lookup by Zipcode tab.
In A4, 6042
In B4, =XLOOKUP(A4,ZipCode!A2:A33122,ZipCode!L2:L33122,"Not Found")
In C4, =XLOOKUP(A4,ZipCode!A2:A33122,ZipCode!E2:E33122,"Not Found")
In D4,
=XLOOKUP(
TEXT(XLOOKUP(A4,ZipCode!A2:A33122,ZipCode!K2:K33122,"Not Found"),"00000"),
'County Recording Fees'!C2:C3204,'County Recording Fees'!E2:E3204
)
The first look up grabs the value in the 'county_fips' column on the Zip Code tab and converts the value to text. Then that value is used to look up the 'FIPS Code' on the County Recording Fees tab in column C, the return value is the 'FirstPageFee' in Column E.
in E4,
=XLOOKUP(
TEXT(XLOOKUP(A4,ZipCode!A2:A33122,ZipCode!K2:K33122,"Not Found"),"00000"),
'County Recording Fees'!C2:C3204,'County Recording Fees'!G2:G3204
)

Need help in generating a formula for nextID excel column

I have a an excel sheet with the following columns
ID, City, Record no.
I need to generate a column called Next ID based on the record number.
i.e if the city is same I need to populate the Next ID column with the ID of the previous record number.
Is there a way to do this in excel?
Here is the sample data, with the Next Column populated manually for reference:
ID City Record no. **Next ID
121 Paris 3
122 Paris 2 121
123 Paris 1 122
124 New York 2
125 New York 1 124
Please see attached image
I've edit the question as I was not able to add a image in the comments. My data is not sorted so I used the second formula. This works for some cases but doesn't work for others. see the pink colored cells which should have a value but do not.
If your data is always sorted use this:
=IF(B2=B1,A1,"")
in D2 and copy/drag down
If not sorted then use this:
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($C$2:$C$6)/(($C$2:$C$6=C2+1)*($B$2:$B$6=B2)),1)),"")

Resources