How to concatenate in cell - excel

I want to concatenate two or more cell but i don't want to concatenate whole cell .Only want to take 2 or more character of 1st cell and 2 or more character of 2nd cell then concatenate them in the 3rd cell.Like..
Student Name Serial number Address Group Section Student ID
Monir 07001 Dhaka,Bangladesh Science B SC001B
I want to take last three digit from the Serial number cell, if it is science from the group cell i want to take only sc and if it is arts i want to take at from the group cell and from the section cell i want to take full character ,Finally concatenate into the Student ID cell.
How do i can do it. Please help me.

Build up what you need slowly:
The last three digits of Serial#: =RIGHT(B2, 3)
Create another table that maps: Science to Sc, Art to At and then use the LOOKUP function. eg =LOOKUP(D2, X2:X6, Y2:Y6), Where column X is filled with "Science, Art, etc" and Y is filled with "Sc,At, etc"
Concatenate is =CONCATENATE()
So the final answer would look something like:
=CONCATENATE(LOOKUP(D2, X2:X6, Y2:Y6), RIGHT(B2,3), E2)

Use LEFT(), RIGHT() or MID() functions for extracting substrings. Use the "&" operator to concatenate. For example:
=RIGHT(C1,3) & LEFT(D1,2) & E1

Excel. Programming. Hmmm.
Anyhoo, I suppose you could use the following:
=LEFT(E2,2) & RIGHT(B2,3) & D2
That gets the first two characters of E2, last three characters from B2 and D2.

Related

Splitting names given in single cells without using text to column excel

i want to use excel formula to split multiple names given in a single cell. dont want to use text to column feature. For example
in the above yellow is the variable name & the green color is the required format
See find the nth instance of a character: FIND(CHAR(1),SUBSTITUTE(string,delimiter,CHAR(1),nth)). For the first, we use LEFT(string,position_first-1). For the last: RIGHT(string,LEN(string)-position_last). For all in between: MID(string,position_first+1,position_second-position_first-1).
So, combining the logic, we may get this:
=IFERROR(IFERROR(IF(B$1=1,LEFT($A2,FIND(CHAR(1),SUBSTITUTE($A2,"/",CHAR(1),1),1)-1),MID($A2,FIND(CHAR(160),SUBSTITUTE($A2,"/",CHAR(160),B$1-1),1)+1,FIND(CHAR(1),SUBSTITUTE($A2,"/",CHAR(1),1+B$1-1),1)-FIND(CHAR(1),SUBSTITUTE($A2,"/",CHAR(1),B$1-1),1)-1)),RIGHT($A2,LEN($A2)-FIND(CHAR(1),SUBSTITUTE($A2,"/",CHAR(1),B$1-1),1))),"")
IFERROR(...,"") is used to return "" after last occurrence (below, in G2). Nested IFERROR(... RIGHT) will be triggered at last occurrence (since MID will fail there; below at F2).
Try using this:
With the full name in cell A2, the formulas go as follows:
Get the first name:
=LEFT(A2,SEARCH(" ",A2)-1)
Get the last name:
=RIGHT(A2,LEN(A2)-SEARCH(" ",A2,1))
You enter the formulas in cells B2 and C2, respectively, and drag the fill handle to copy the formulas down the columns. The result will look something similar to this:

Extracting a Number/Letter Code (C2, H3, W1 etc) from a text cell in Excel

I have an Excel list with course names and their number like this:
V3 Varikosis Masterclass
B3 Botulinumtoxin Premiumkurs, H2
M1 Mykologie Basiskurs [Digital], D1 Dermatoskopie Basiskurs [Digital]
B5 BTX Workshop (21.11.21) (sometimes there are random numbers that have nothing to do with the code like a date)
It's very messy since some people ordered two courses, so I can't just take the first two symbols from each cell. Is there a formula that finds and extracts a single letter and number combination from a string of text?
If you do not have any other cases e.g. max number of courses is 2 and comma and space is always the same it is rather straightforward.
=LEFT(A3,2)
=IFERROR(MID(A3,SEARCH(",",A3,1)+2,2),"")

Using Index/Match on external sheet with delimited cells

I have a spreadsheet, Alpha that references an external spreadsheet Bravo.
I need Alpha's B2 cell to check in Bravo for all cells in column A that contain the string in Alpha A2. If it finds a match it copies the value from the B column for that row to Alpha B2. I've currently got this working using the following formula:
=INDEX([Bravo.xlsb]Sheet1!A$2:B$22,MATCH(A2,[Bravo.xlsb]Sheet1!$A$2:$A$22,0),2)
..however, I have some cells in Bravo that have multiple strings separated by delimiter that need checking. To complicate matters some of the reference cells in Alpha's A column have multiple strings separated by delimiter. Ideally the images below show how I need this formula to work:
Alpha.csv:
Bravo.csv:
So my question is, how can I modify the formula to work with cells that contain delimitered strings as well?
Update
To clarify this is how Alpha looks before any formula is run:
Alpha.csv (pre-formula)
Items Category Group (results)
Oranges|Chicken
Ice Cream|Pears|Steaks
...and this is how Bravo looks
Bravo.csv
Item Categories Category Group
Fruits>Pears|Fruit>Oranges Fruits & Health
Meat>Steaks|Meat>Chicken|Meat>Lamb Meats
Deserts>Ice cream Deserts & Sweets
I need B2 of Alpha to take each string in A2 (separated sometimes by delimiter for multiple strings) check through Bravo A column for a match for each string. If it finds a match it adds the corresponding category Group name from Bravo's B column to the Alpha B2 cell.
It repeats this for each string in A2 and if there are multiple strings adds in a | delimiter until all strings have been checked. The result would look like this:
Alpha.csv (post-formula)
Items Category Group (results)
Oranges|Chicken Fruits & Health|Meats
Ice Cream|Pears|Steaks Deserts & Sweets|Fruits & Health|Meats
One option would be to simply use the Text-to-Columns feature to delimit your list in your Alpha document. That will allow you to use this formula:
=INDEX([Bravo.xlsx]Sheet1!$B:$B,MATCH("*"&A2&"*",[Bravo.xlsx]Sheet1!$A:$A,0))
This formula looks for the value in Alpha A2 with any values before it and any values after it within column A in Bravo.
Otherwise you would have to be more specific on what you which category you would like to search, in which case you can utilize right() mid() and left() to adjust your match() function.

Extract two numbers out of a string in Excel

I have a string that I need two numbers extracted and separated into two columns like this.
ID:1234567 RXN:89012345
ID:12345 RXN:678901
Column 1 Column 2
1234567 89012345
12345 678901
The numbers can be varying number of characters. I was able to get column 2 number by using the following function:
=RIGHT(G3,FIND("RXN:",G3)-5)
However, I'm having a hard time getting the ID number separated.
Also, I need this to be a function as I will be using a macro to use over many spreadsheets.
A way to do this is:
Select all your data - assuming it is in a string all the time - which means one cell has one row with ID&RXN nos. So if you have 100 rows such data, select all of it
Go to the Data tab, Text to columns
Choose Delimited>>Next>> choose Space here, in Other, type a colon(:) >> Finish
You will get "ID" in first column, every cell; ID no in second column every cell; RXN in third column every cell and RXN no in 4th column every cell.
Delete unwanted columns
With data in column A, in B1 enter:
=MID(A1,FIND("ID:",A1)+LEN("ID:"),FIND(" ",A1,FIND("ID:",A1)+LEN("ID:"))-FIND("ID:",A1)-LEN("ID:"))
and copy down. In C1 enter:
=MID(A1,FIND("RXN:",A1)+LEN("RXN:"),9999)
and copy down:
The column B formulas are a pretty standard way to capture a sub-string encapsulated by two other sub-strings.
If your format is always as you show it,then:
B1: =TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1," ",REPT(" ",99)),":",REPT(" ",99)),99,99))
C1: =TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1," ",REPT(" ",99)),":",REPT(" ",99)),3*99,99))
We substitute a long string of spaces for the space and : in the original string. Then we extract the 2nd and 4th items and trim off the extra spaces.

Copy part of a cell contents (with no clear seperator)

I have a number of 'accounts' for which i would like to create a unique reference code for each. The reference code will be a combination of parts of different cells. So, for example, the reference for the 'account' occupying row 1 would be: cp78925
The cp part is a constant, and will always be the same.
The 789 part are the last three digits of cell A1, which contains a 10 digit code
The 25 part are the first two digits of cell B1, which contains the date on which the account was opened.
So for example:
if A1 = 1123456789, B1 = 25/10/2013 then the unique reference code in C1would be = cp78925
Searches on the internet show ways of separating the contents of cells by blanks (""), /, after letters etc., or making the last 3 digits BOLD/ITALIC, but I cant work out how to get my specific answer.
Thanks a lot in advance. I hope this is clear enough.
you need something like
="CP" & RIGHT(A1,3) & DAY(B1)
="CP" & RIGHT(A1,3) & TEXT(B1,"dd")
Anyway this formula is not going to give you an unique reference if two A1 code ends with the same 3 digits the same day.
1234567890 01/01/2013
3213512890 01/02/2013
Both will return you CP89001
Edit:
As reported by Sam092 (thanks), DAY() return a numeric value, TEXT() is the right function to use
Formula in C1
="CP"&RIGHT(A1,3)&LEFT(TEXT(B1,"DD/MM/YYYY"),2)
EDIT:
I see that you have tagged your question with VBA. You don't need vba for this but still if you want a VBA solution then try this
ThisWorkbook.Sheets("Sheet1").Range("C1").Formula = _
"=""CP""&RIGHT(A1,3)&LEFT(TEXT(B1,""DD/MM/YYYY""),2)"
or
ThisWorkbook.Sheets("Sheet1").Range("C1").Value = Evaluate( _
"=""CP""&RIGHT(A1,3)&LEFT(TEXT(B1,""DD/MM/YYYY""),2)")

Resources