How to recode multiple text variables in excel - excel-formula

I need advice on how I should recode text to numbers or vice versa or a combination of text and numbers. In the example, I need to recode Singapore to 1, Malaysia to 2, Japan to 3 and Vietnam to 4 and so on. Column A contains all the countries, and column B should contain the recode data. I tried using the replace and substitute commands and while it is able to do the job, it only replaces one text within a single cell. Because of this, I am not able to copy the formula down the column. Is there a single formula that I can include all the variables I want to recode, then apply the formula to all affected data column-wise?
Example

A lookup table would be conventional but:
=MATCH(A2,{"Singapore","Malaysia","Japan","Vietnam"},0)
in B2 and copied down might serve (extended with more countries to suit).

Related

if cell equals data from a table, then data from a different column but same row of that table

So here's my problem.
Work just told us we're gonna have to fill out a form that used to be annual, quarterly now. so I wanted to make it a little bit easier on us by making the form a bit more automatic.
I know I could just do a nested if statement, but with 20 some-odd people I'd like to avoid that if possible.
Here's my idea:
On the main form, there is a place to put your name. I put in a data validation based off a table containing all the names. That table also includes their employee numbers and necessary serial numbers.
[![Example Officer Data Table][1]][1]
My real question is, how do I write a formula where if the name cell (let's say A1) equals Off 1 1, then it pastes the employee # of 000001, but if A1 equals Off 7 7, then it pastes employee # 000007, and all the other variations, WITHOUT nesting a bunch of ifs. Is that possible? Because I don't just need a code to paste the Employee #, I also need one to paste the Serial # (I realize that I could just nest the ifs for a column over, I just don't want to if there's a more concise way to do it)
Let's say you have the following table, where F1 has data validation coming from A2:A4. Them in F2 I added the formula =VLOOKUP(F1,A2:C4,2) where the 2 means the second column of the interval A2:C4, and in F3 the formula is =VLOOKUP(F1,A2:C4,3)

Excel concatenation multiple values into a single cell based on condition

Hi guys I'm new to excel and i would like to concatenate the country names into a single cell separated by '/'for the particular corresponding customer as shown in the below
colA1 colB1
A India
A UK
A USA
A Japan
A India/UK/USA/Japan
B India
B UK
B USA
B Japan
B India/UK/USA/Japan
i am expecting the results in the above highlighted row using excel.
Thanks for your help
The easiest way to concatenate cells is by using &. Just use it between cell names and it should work.
In order to add other characters in between the text on the concatenated cells (including spaces), use "".
So, in order to fulfill your request, you should use something like the below (assuming the cells you want to concatenate are in column A:
=A1&"/"&A2&"/"&A3&"/"&A4
Considering you would like to add "A" to the first word (India) but not to the others, you can try the below formula:
=(A1&"/"&RIGHT(A2,LEN(A2)-2)&"/"&RIGHT(A3,LEN(A3)-2))&"/"&RIGHT(A4,LEN(A4)-2)
It will consider A1 in full, A2 in full minus the first 2 characters and so forth. You can use the same formula for part B if you replace the cells within it. Hope that's what you're looking for.

Two Names in Field

Currently, I am working with a scenario where I have 0 to 6 names in the field. For example, A2 has Bob Smith and Jone Random. Below is an example how they look in a check.
Effi Liu
<- (enter/gap)
Kevin Xing
Basically, I want to generate a 1 column that counts how many people in A2. For example, two people and then create a function that will separate. Each of the names into different columns.
If you have the names separated by the Enter Key in Column A, use the below formula in Column B and drag it to the right upto 6 or more cells and then drag down,
=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1,CHAR(10),"#"),"#",REPT(" ",999)),(COLUMN(A:A)-1)*999+1,999))
This formula splits your name strings with the Enter Key as the delimiter into multiple columns as you drag. You could then use COUNTA function to find the non-blank cells (number of names). I leave that part to you to google and find it. Hope this helped you.

How to create a data validation list based on certain criteria and data from another workbook?

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.

how to: find matching names in different columns in an OpenOffice Calc spreadsheet?

I have a spreadsheet that has 5 columns, each column holds a full name (First Middle Last) in each cell.
How can I produce a report showing which names are shared between which columns, for example,
Report:
John Brown is in columns A,D,E
James Kennedy is in columns B,E
etc
And just in case it matters to you, the different columns have different numbers of cells, one may have 50, another 700 etc.
I was looking at an example here showing how to do something a little similar with numeric data using countif but I don't really understand it or how if could apply to what I'm doing.
Thanks
Not sure if this is what you want....
Here, I check in column E if the value of THAT row in column B does exist in column A, then in column F, I check if the value of that row of column C exists in the list in column A. Since I use a European setting, the parameter separator, which normally is a comma (,), is replaced by a semi-column (;) in my example...
As you can see there are some issues with finding 10, 11, etc. With normal names that should not be an issue.

Resources