Format numbers in cells with text - excel

I have cells that look like this: 1000 (1.0) and I would like to format the first part of the cell with commas separating the thousands, i.e 1,000 (1.0).
I've tried using the text function in a formula i.e. =text(A1,"0,000") or =text(A1,"#,###") but this didn't add a comma.

Excel sees the cell as a text string and as such it cannot be formatted. You need to parse the string and put it back together:
=TEXT(LEFT(A1,FIND("(",A1)-1),"#,##0") & " " & MID(A1,FIND("(",A1),20)

Related

How to extract a string with a decimal dot to a cell with VBA?

I'm extracting some strings from email subject into sheet cells. One of them is like this:
The output in the cell is:
My decimal symbol in regional settings (Windows) is set to comma, not dot.
Code for placing the related string inside the cell:
sh.Range("Q" & rCount) = Mid(.Subject, 8, 5)
Why the difference? How to keep it "20.00" without setting cell format to text? When I input the same string manually into cell, it does not change and the cell format is still General.

How can I put a single Quote in a string without the backslash in VBA?

I want to format the data of my table with a number format like this:
wsOptimisation.ListObjects("tblOptiData").DataBodyRange.NumberFormat = "#'##0.0 ""mm"""
If I run this Code it pastes it like this:
#\'##0.0 "mm"
VBA adds the backslash and thus it won't get recognized as the 1000 seperator.
Edit:
I changed the 1000 seperator from , to '
How can I get rid of the backslash?
Image from Format Cells Window in Excel:
excel
I tried using the Chr(39) function, but same issue.

group separator in excel

I would like to add group separator to a column of texts with numbers in it,
e.g. from 78898 (30.18%) to 78,898 (30.18%)
but the NUMBERVALUE function didn't work.
And if convert using the "text to columns", then (30.18%) will be converted to -30.18%.
How can I do to achieve that?
Thanks!
With data in A1, in B1 enter:
=TEXT(--LEFT(A1,FIND(" ",A1)-1),"#,##0") & MID(A1,FIND(" ",A1),9999)
We:
parse the string
convert the leading part to a number
format the number
re-assemble the string

Format a number as a percentage within a concatenated '& string' cell in Excel

I want to output something like this: "cat1/cat2 split: 25%/75%" in a cell by concatenating a string, "cat1/cat2 split: " with two cell references containing fractions.
My first and obvious attempt of concatenating by using '&' works, but looks like this: "cat1/cat2 split: 0.25/0.75"
How can I format this to display those values as percentages?
How about:
=A1 & TEXT(B1,"00%") & "/" & TEXT(C1,"00%")
where A1 contains the text and B1 and C1 contain the fractions

Excel and cell formatting to text

I have a cell with the contents of 41316. I have it formatted as 20130211.
I need another cell to reference that value, but in the cell have it showing as 20130211 not 41316 formatted.
This maybe an easy one, but for some reason it has me running in circles.
Thanks in advance for all responses.
Excel by default copies the format from a cell formatted as a date to a cell which references it. It sounds in your case that Excel hasn't done that for you, so you just need to format the new cell with your special format : paintbrush tool or Edit..Copy, Edit..Past Special..Formats or Format..Number..Custom and select your format, which will be at the bottom of a long list.
If a string is ok instead of a number, you can decompose that date in parts and concatenate:
Being A1 the cell containing the value:
= Year(A1) & "/" & Month(A1) & "/" & Day(A1)
The "&" symbol concatenates text. The slashes are optional if you want them separated by slashes.
if your cell referencing 20130211 is 'A1' put =TEXT(A1,"####") in your calculation cell. If you do it this way then it will still read as a number and not a string

Resources