Excel Formula with concatenate - excel

I am trying to generate a customer number using the first three letters of the customers last name, the first name initial and middle initial, followed by the last four of their phone number. How would I do this? All I need is the formula.
First_Name Middle_Initial Last_Name Street_Address City State Zip Phone
Nathaniel E. Conn 6196 View Ct Lancing TN 37770 567-273-3956

Something like this (assuming a table with [structured-references], fill in the actual cell names if not):
=LEFT([LastName] & "---", 3)
& LEFT([FirstName] & "-", 1)
& LEFT([MiddleInitial] & "-", 1)
& RIGHT([PhoneNumber] & "----", 4)
I have used dashes ("-") to fill in any spaces where the field might be smaller than the number of characters you need from it. You can change them to any fill character that suits you.

Well, it depends on if each piece of data has its own column, looks like it does.
You can use the left/right functions to parse the data out of your columns.
=CONCATENATE(RIGHT(C1,3) & LEFT(A1,1) & LEFT(B3,1) & RIGHT(H1,4))

I would do:
=MID(CELL_LAST_NAME;1;3)&MID(CELL_FIRST_NAME;1;1)&MID(CELL_MIDDLE_NAME;1;1)&MID(CELL_PHONE;LEN(CELL_PHONE)-3;4)

Related

CStr does not handle 3 decimals figures with comma

I have the following issue.
When I try to do :
cell.value=CStr(cell.value)
it works with numbers like 6,91.
But when I try with numbers like 6,911 I get 6911 in return when I just want 6,911 instead.
I'm using commas because I'm in Europe, I guess maybe VBA mixes it up with the American way of writing thousands with a comma.
Indeed, here I only want a decimal with 3 figures after the comma
This does not what you expect it to do
cell.value=CStr(cell.value)
Here CStr(cell.value) will turn it into a String but if you write a string into a cell that looks like a number Excel "thinks" and turns it back into a number. Here comes the confusion.
If you want to format that cell as text use
Cell.NumberFormat = "#"
Cell.Value = Format$(cell.Value, "0.000")
or use Cell.Value = "'" & Format$(cell.Value, "0.000")

Separate full address into street address, city, state, zip, country in excel

[I have more than 47K Full Address Data of different countries and I want to split them into Address, City, State, Zip Code, Country.
I have tried many ways but couldn't work any formula as these addresses are different in structure and pattern
N.B: I Don't have good knowledge about Excel VBA or Macro]
This task is too complicated to perform with a simple formula, you'll need VBA to do it, let me give you some guidance:
You can count the amount of commas in order to guess the content (apparently some addresses start with the name of the building). In case the name of the building is not there, just add a comma in order to have the same format everywhere.
Once everything has a similar format (the amount of commas is equal everywhere) you can start splitting, based on the comma as a separator. The results will be "Name", "Full street name and number", "Full city ID", ...
Things which are still composed of different items (like "Full city ID") can be split by taking the first part (which is a number, separated from the rest by a space) and the second (the rest of the "Full city ID").
Edit: add small macro
This macro contains the functions Split() and IsNumeric(), it's all you need:
Sub test()
Dim A, B As Integer
T = Split("1, 2, X", ",")
If IsNumeric(T(0)) Then A = T(0) Else A = -1
If IsNumeric(T(2)) Then B = T(2) Else B = -1
MsgBox "Result : A=[" & CStr(A) & "], B=[" & CStr(B) & "]"
End Sub

Zero infront of a number like 2031.04

I want to create an order ID like 2031.04. But at the moment i have the problem, that the zero behind the dot is missing so it looks like that.
I have one cell witzh 2031 and another with n + 1. Then i want wo show these two cells in one with the following format.
2031.1
2031.2
...
2031.9
2031.10
Can i somehow add a zero in there.
Thanks in advance.
Based on this comment from OP:
The part behind the dot gets incremented in another cell and in this
cell i just wanna show the fist part "2031" dot the second part "04"
= 2031 & "." & <cell reference>
Sounds like you could just concatenate it:
Also, if you want to just statically input the ID, then simply change the cell format from General to either Text or Number (with two decimals)
EDIT:
Starting from D3:
=IF(ISBLANK(AF3), AF3, AF3 & "." & AG3)

Can i add multiple text with formula?

Are there any way to multiple text wording with formula?
Also how do I change the decimal to 0.00??
Thanks in advance!
Current working code
="Should be at " &CONCATENATE(NETWORKDAYS("3/4/2018",TODAY()-1)/35*(100))
I would like to add wording after formula like this
="Should be at " &CONCATENATE(NETWORKDAYS("3/4/2018",TODAY()-1)/35*(100)) "% to Goal"
You do not need the CONCATENATE() just the & to do it:
="Should be at " & TEXT(NETWORKDAYS("3/4/2018",TODAY()-1)/35*(100),"0.00") & "% to Goal"
TEXT returns the numbers returned by the math, in the 0.00 format
The & concatenates each part into one string.
To use CONCATENATE: you would wrap the whole and replace the & with ,:
=CONCATENATE("Should be at ",TEXT(NETWORKDAYS("3/4/2018",TODAY()-1)/35*(100),"0.00"),"% to Goal")
But that is more typing than just using the &
Just for the sake of an alternative,
=TEXT(NETWORKDAYS("3/4/2018", TODAY()-1)/35, """Should be at ""0.0%"" to Goal""")
Modify 0.0% to suit your desired percentage accuracy.
To preserve your number for future calculations use,
=NETWORKDAYS("3/4/2018",TODAY()-1)/35)
Then format the cell with a custom number format of,
"Should be at "0.0%" to Goal"
'optional full format mask with +, -, zeroes as hyphens and red text (to note mistakes in input)
"Should be at "0.0%" to Goal";"Should be at "-0.0%" to Goal";_(* "-"_);[Red]_(#_)
This preserves the raw percentage for further calculations while displaying the expanded text.

Delete set number of characters following the first character

I have dummy emails that are too long. I want to shorten them but I don't want to delete the first parenthesis.
"est#scelerisque.ca"
"fermentum#fringillacursus.edu"
"adipiscing#arcuVivamussit.com"
"vitae.aliquet#Sed.edu"
"magna.tellus#Nullamnisl.com"
"placerat.eget#purusNullam.org"
Is it possible for me to delete for example the first 3 letters after the (") and the next 3 letters after # and stop at the dot?
As i ask this, it sounds really complicated. I may just use the same email for all users since it's just dummy data :/
If you have one email in each cell, you can create an excel formula which will
convert email values for you.
Delete 3 letters after ":
=CHAR(34) & MID(A1, 5, LEN(A1))
(Using result of previous formula in B1):
Skip 3 letters after #:
=MID(B1, 1, FIND("#", B1)) & (MID(B1, FIND("#", B1)+4, LEN(B1)))
(Using result of previous formula in C1):
Stop at the dot (also keep " at the end):
=MID(C1, 1, FIND(".",C1)-1 ) & CHAR(34)

Resources