I have two excel sheets, One numeric and another text.
Numeric and text sheet has 5 observations and the first column is country. Data dictionary for country is 1='US', 2='Germany',3='India',4='China'.
I am looking for a VBA code that can compare values between two sheets based on data dictionary codes. Also the country column shouldn't have any data other than what is available in data dictionary. In this example, there is also an option 5 that is not available in dictionary and this needs to be highlighted as error.
Sheet1: Numeric Sheet2: Text
Country Country
1 US
1 US
2 Germany
3 India
4 China
5 China
As suggested in one of the comment maintain two consecutive columns in any sheet, first one with the country code and other one with the corresponding country name. then use can use vlookup() function to get the the country name... for ref click here
Related
I have an odd question I could do with some expert advice on. I have two tables in Excel, in different sheets:
in Table 1 I have a list of cities (C:C), each one with a unique numerical identifier (B:B), to account for cities that have the same name despite being in different countries (e.g. Dublin being in Ireland as well as California and Texas, for example);
in Table 2 I have a list of "groups", each group being a continent/geographical area (B:B), each one with a list of cities that fit under that area, with the city name and its unique numerical identifier (D:D).
I now need to create Table 3 (in a separate sheet), which has the following layout:
A:A has the names of the cities
B:B asks is the city is part of a group (to return a YES or NO)
C:C returns the name of the group, if the city is part of one, or just a blank cell, if the city is not part of a group.
I can't seem to think of formulas that can fit in Table 3's B and C columns. Would this be a case of INDEX and MATCH? Any help is greatly appreciated. (I've attached a screenshot as an example.)
Screenshot from example
Edit:
I'm using Excel on Mac (Big Sur)
My Excel version is the latest stable release, 16.47.
You might use this formula in N2 of your posted worksheet and copy down.
=INDEX(G2:G3,MATCH("*" & L2 &"*",I2:I3,0)).
Perhaps it makes sense to include the trailing opening parenthesis in the match:-
=INDEX(G2:G3,MATCH("*" & L2 &"(*",I2:I3,0)).
In cell M2 you might use a formula like this one:-
=IF(COUNTIF(C:C,L2)>1,"Yes","No")
need some help on my excel production report.
I want to Lookup for the daily unique ID, gram and pieces from Sheet 1 into Sheet 2.
The daily unique ID consists of up to 5 categories.
Each day, there could be up to a maximum of 3 unique ID produced with each one having different categories (some have 2 same categories with different grams and pieces. It need to be shown in a separate column in Sheet 2), grams and pieces.
I came out with an excel formula but it only works IF there is only one daily unique ID per day. If there is more than one unique ID, this formula fails as it only captures the first one.
Please see my formula below
I2:I100 is the gram in Sheet 1
E2:E100 is the "unique code-category" in Sheet 1
D11 is the unique code in Sheet 2
P11 is the type of categories
{=IFERROR(INDEX('A'!$I$2:$I$100,SMALL(IF(($D$11&"-"&$P$11)='A'!$E$2:$E$100,MATCH(ROW('A'!$E$2:$E$100),ROW('A'!$E$2:$E$100)),""),ROWS($A$1:$A1))),"")}
Is there a way I could capture everything?
Can I do it with excel formula or a VBA is required?
I have tried many different formulas but nothing came out right, please help :(
Please let me know if my explanation isn't clear. Thanks.
Sheet 1
Sheet 2 (Final Report)
I want to compare data in two excel cells (from two columns) and write the matching values only to third column.
I have two lists of countries, column B has roughly 120 countries while column A has roughly 192 countries. I can't figure out a way to display the countries that correspond with each other (seeing if B belongs in A).
Here is an example of what I pulled off from another thread and it doesn't work for me.
excel question
Now, here is my spreadsheet.
My spreadsheet
I just want to validate and compress the countries that are listed in column B to see if they match Column A and print them in C.
Please let me know how I would do so?
Thanks,
You can use this formula in cell C1 and drag down as far as necessary.
= IF(SUMPRODUCT((B1=A$1:A$192)+0)>0,B1,"")
This formula returns the country name in the cell next to it if the country exists in the A column, and blank otherwise.
I have a large excel sheet that contains duplicates unique numbers, but the information behind each unique number differs. The original sheets needs to be partially copied to a new sheet. The new (master) sheet needs to contain the same unique number, but calculates the total order and tax value. Please see a simplified example below.
Sheet 1
Unique number Product value Tax
1 a $5.00 $1.00
2 b $4.00 $0.75
2 a $7.50 $1.50
3 e $3.00 $0.50
To sheet 2
Unique number value Tax
1 $5.00 $1.00
2 $11.00 $2.25
3 $3.00 $0.50
Any guidance is much appreciated
I did it with the use of a helper column.
So the first thing I did was to generate a list of unique number. I did it with a formula, but there is also a function built into Excel that will do this. The following formula generate a list of unique numbers and places a blank where values are duplicated.
=IF(COUNTIF($A$1:A1,A1)=1,A1,"")
I placed that in the first column of your new table. In the second column of your new table I sorted the list and removed the blank using this formula:
=IFERROR(SMALL($G$1:$G$4,ROW()-ROW($A$1)+1),"")
Then as per ctumturks comment I used sumif as follows:
=IF($H1="","",SUMIF($A$1:$A$4,$H1,C$1:C$4))
That last formula can be copied to the right to sum each subsequent column.
to use the built in function for removing duplicates, select all the unique numbers. Copy and paste them to your new sheet. In your new sheet select the unique numbers again. Go to your Data ribbon at the top. About half way across there is a tool called "Remove duplicates". This will remove duplicate numbers in place and remove spaces at the same time. After you have completed this you should only need the last formula above in the adjacent column.
I have two Excel spreadsheet files (2 workbooks), one stores all the data, another wants to create a list based on certain criteria from the data in the previous workbook. Here are the two files:
File A:
A B
1 Chen China
2 Li China
3 Smith Britain
4 Tanaka Japan
5 Hironi Japan
On File B, I have two cells:
A B
China ?
Cell A1 is a list of countries such as China, Japan, etc. I have no problem creating this. But B1 needs to have a data validation list that reads data from File A. The list should not list all the items but based on the value of A1, say if A1 is China, B1 will have a list of two names: Chen and Li.
I can achieve it if all the sheets in the same workbook, but no matter how I tried, I couldn’t figure it out how to do that with separate spreadsheet files. I prefer using formula, but if necessary writing VBA code is also not a problem.
Thanks!
Not sure where you are with your formula but with a couple of tweaks this array should work, or at least provide a basis for you to solve your problem. The tweaks are (1) switch columns so the country is colA; (2) replace data file.xls and the sheet no. with your own; (3) drop the formula in B1 and drag it to (say) F1. Then you will need to edit the row reference in the formula by adding 1 each time i.e. the row ref in B1 will be ROW(1:1).... C1 will be ROW(2:2) etc
=IF(ISERROR( INDEX('[data file.xls]Sheet7'!$A$1:$B$5,SMALL(IF('[data
file.xls]Sheet7'!$A$1:$A$5=$A$1,ROW('[data
file.xls]Sheet7'!$A$1:$A$5)),ROW(1:1)),2)),"---", INDEX('[data
file.xls]Sheet7'!$A$1:$B$5,SMALL(IF('[data
file.xls]Sheet7'!$A$1:$A$5=$A$1,ROW('[data
file.xls]Sheet7'!$A$1:$A$5)),ROW(1:1)),2))
Remember this is an array formula so shift+ control+ enter. Hope it helps.