Can i add multiple text with formula? - excel

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.

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")

Find specific characters and return the next value in the cell using Excel Formula

I am not sure where to begin with the formula as I have gotten myself so confused with everything. I have a cell the contains "PON " or "PON: " or "PON = " then the actual PON (Example: PON 123467) I want to formula to return 123467 in the cell.
Examples What I want returned
I have PON 123467 for shoes 123467
I have PON: 234567-AB for food 234567-AB
I have PON - 569874-Weird for accessories 569874-Weird
I have PON = DOG-564-987 for dog food DOG-564-987
I am currently using Excel 365
Filterxml() will give you best companion here in this case. Try-
=FILTERXML("<t><s>"&SUBSTITUTE(FILTERXML("<t><s>"&SUBSTITUTE(A1," for","</s><s>")&"</s></t>","//s[1]")," ","</s><s>")&"</s></t>","//s[last()]")
Using FILTERXML, and testing for a substring following PON, you can try:
=FILTERXML("<t><s>"&SUBSTITUTE(TRIM(A1)," ","</s><s>") & "</s></t>","//s[contains(.,'PON')]/following-sibling::*[string-length(.)>2][1]")
Note that FILTERXML solution will cause a PON that is solely numeric, but with a leading zero, to drop the leading zero. Unfortunately, the xPath implementation in that function does not include the string() function
If dropping the leading zero might be a problem, you can add a character to the node that will force the number to be seen as a string. In the modified formula below, I use the unicode zero-width space, but there are others you can use. Note that this will count as a character for the string=length function, so be sure to maintain the >2 parameter:
=FILTERXML("<t><s>"&SUBSTITUTE(TRIM(A1)," ","</s><s>"&UNICHAR(8203)) & "</s></t>","//s[contains(.,'PON')]/following-sibling::*[string-length(.)>2][1]")
Because of the variablity in your data, that sometimes there are extraneous space-separated substrings between PON and your desired extract, the xpath:
locates the substring PON
returns all subsequent siblings that have a string-length of more than two (adjust if necessary)
returns the first sibling that meets that criterion.
You might try this formula.
=TRIM(LEFT(MID(A2,FIND(#{1,2,3,4,5,6,7,8,9},A2),100),FIND(" ",MID(A2,FIND(#{1,2,3,4,5,6,7,8,9},A2),100))))
It extracts the text between the first number and the first space following that number. The size of that extract is limited to 100 characters.

Excel 2013 reduce concatenated decimals

My intention is to display both the min and max values from a small data set in one cell, which I've already accomplished by using the concatenate function:
=min(A1:A23)& - max(A1:A23)
But the function displays all of the decimals (the values in range are the result of another function, a division) and I can't reduce the quantity of decimals in the cell.
Picture of the problem
If you replace your function with
=Round(Min(A1:A23),2)&"-"&Round(max(A1:A23),2)
Then you will get the results 5,23-10,74 which is, I presume what you are looking for. The documentation for the Round function is here https://support.office.com/en-us/article/ROUND-function-c018c5d8-40fb-4053-90b1-b3e7f61a213c. You can change the number of decimals to whatever you want.
Use this:
=ROUND(MIN(A1:A23);2) & " - " & ROUND(MAX(A1:A23);2)
Change the 2 to the number of decimals desired.
Use the TEXT() function:
=TEXT(MIN(A1:A23),"0.000") & " - "&TEXT(MAX(A1:A23),"0.000")
Change the format mask to display exactly what you want.

Excel Formula with concatenate

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)

String conversion with TEXT formula character limit?

I am attempting to format a single number stored as a text value.
For example, I would like to convert:
5145350002005000080
To:
5145-350002-00500-0080
The formula I am using is:
=text(A1,"0000-000000-00000-0000")
The output I am receiving is:
5145-350002-00500-0000
Why are the last 4 characters "0000" instead of "0080" as I would expect? Is there a character limit, or is my formula incorrect?
Quote from Large Number Arithmetic:
The limit in Excel is 15 significant digits in a number. Enter a 16
digit credit card number and 1234567890123456 will become
1234567890123450.
Actually, even 5145350002005001111 will result in 5145-350002-00500-0000.
Moreover, take a look at formula bar when your input cell is selected - for my Excel 2007 I see:
Hope that was helpful)
EDITED:
As a solution to solve the task - keep your numbers formatted as text and use the following formula:
=LEFT(A1,4)&"-"&MID(A1,5,6)&"-"&MID(A1,11,5)&"-"&RIGHT(A1,4)
Here is a custom function. Place it in a regular code module of the workbook and you can call it in the cell by =FormatLargeNumber("A1")
Public Function FormatLargeNumber(val As String)
'This function parses extremely large numbers per your example.
' Modify as needed.
FormatLargeNumber = Left(val, 4) & "-" _
& Mid(val, 5, 6) & "-" & _
Mid(val, 11, 5) & "-" & _
Right(val, 4)
End Function

Resources