Append % sign to this excel cell which uses a function - excel

I have this cell in Excel 2013. The contents of the cell is;
=xlqChangePercent($D2,$AP$1)
This function returns 1.00 which is displayed in the cell. I want this cell to display 1.00%. I tried =xlqChangePercent($D2,$AP$1)% but the cell becomes 0.01. How do I get the cell to display 1.00%?

Either append /100 to your formula and format % (retains content as a number) or format the cell with a custom format of:
#.00"%"
which results in a text string.

Format the cell to percentage - either use the menu or right-click on the cell and choose format.

Related

Return custom format of a cell (i.e. [$EUR ]#.##0,00;[Red][$EUR ]-#.##0,00)

is there a way to use VBA (or some excel function) to return a custom format that is used?
For example:
in cell A1 I have a value of 100 with custom format [$EUR ]#.##0,00;[Red][$EUR ]-#.##0,00
in cell A2 I have a value of 100 with custom format [$PLN ]#.##0,00;[Red][$PLN ]-#.##0,00
So basically, in A1 I have red colored EUR -100,00 and in A2 I have red colored PLN -100,00
Now let's assume I want do some calculations with only those cells that are formatted as EUR (in example above it means the cell has [$EUR] inside it's custom format.)
Any ideas on how to get that custom format string or anything else that will help me to differentiate those two cells by their custom format?
I tried Excel formula CELL("format";A1) and CELL("format";A2), but they both return ,2-
I've seen many VBA solutions to format a cell, but I haven't found any VBA function that returnes the custom format used (there are ways to return some general stuff like color, is it number etc, but I didn't find any custom format returns).
If you want to read that cells formatting (custom or not) then use:
Range("A1").NumberFormat
If you want a small UDF, that you can call from the worksheet itself, you need a small amount of VBA:
Create a new module, if you don't have one.
Paste into it the following:
Function formatting(rng As Range) As String
Application.Volatile
formatting = rng.Cells(1, 1).NumberFormat
End Function
Note, this will always return the formatting of the first cell within the range.
Then, in any given cell you can call that function- e.g.
=formatting(A1)
From there, you can use normal text manipulation functions such as Left, Mid etc. to locate the colour code or currency symbol - e.g.
=IF(LEFT(formatting(A1),2)="[$",MID(formatting(A1),3,3),"No currency found")
would give the result EUR

Excel Chart title will not accept a date concatonated to a string

I'm trying to include a date in my excel chart title by putting a formula inside the title formula box:
="Some text "&TEXT(NOW(),"mmm dd")
I've tried putting the date into a cell, and referencing the cell, but that doesn't work:
="Some text "&TEXT(Statistik!$H$26,"mmm dd")
Strangely, I can put a date into the chart title:
=Statistik!$H$26
But as soon as I add text ("eg "&), it gives me an error message that there is something wrong in the formula. If I paste the same formula into a cell, it works fine. =Concatonate doesn't work either.
All credit to Rory. Put the whole formula into a cell, then just refer to that cell.
Concatenation within the title cell of the excel chart does not work. The title cell needs to be a single reference to another cell, eg, =A1, in which any concatenation occurs, eg, ="Some text "&TEXT(Statistik!$H$26,"mmm dd").

How to put todays date and time in excell cell

Within an Excel cell, I want to have the current (dynamic) date time printed.
I tried with following format:
TEXT(TODAY(); "ddmm");TEXT(TIME(HOUR(NOW());MINUTE(NOW());SECOND(NOW()));"mmss")
The format cell is not formatted as text. However, when I select the cell I have exactly that what is typed iso 07111533
I tried already with TEXT(TODAY(); "ddmm") and then my cell is filled with 0711, which is ok.
Expected result should be something like 07113815
Actual result:
TEXT(TODAY(); "ddmm");TEXT(TIME(HOUR(NOW());MINUTE(NOW());SECOND(NOW()));"mmss")
You're over-complicating:
=TEXT(NOW(),"ddmm") & TEXT(NOW(),"mmss")

How to convert the result (as displayed) in the cell to text in Excel

I have formatted a cell in Excel as Scientific with 1 decimal place then I inserted a number in it like (0.41). After pressing enter the result displayed is (4.1E-01). My aim is to put this result in a cell with text format so that when I double click the cell, I can copy/modify the text (4.1E-01) as I want.
I tried to format that cell as text but the result gets back to 0.41. I also tried to copy the cell and paste the value only using "Special Paste" into a text-formatted cell but the result keeps returning to 0.41. Do you have a suggestion on how to solve this issue?
Thanks in advance
This is a bit of a work around unless you want to use VBA. In an adjacent cell type this formula:
=TEXT(A1,"0.00E+00")
Now you can copy that cell and paste values only and get just the text:
2.22E+27
If your okay with VBA use this:
Range("A2").Value = Range("A1").Text

Change text data to correct datatype

I'm populating an Excel sheet from DTS. The result is formatted as text since DTS sees the cells as varchar(255).
The cell-formatting is correct. The problem is that Excel is thinking of the data as text instead of datetime or numeric.
E.g. the value in a cell shows as "2009-01-01 00:00:00". If I press F2 to edit the cell, then press ENTER, Excel realises it's a date and then formats it according to the cell formatting.
How can I format the values as numeric or datetime with VBA?
Seems you can just assign the value of a cell or range to itself and that lets Excel determine the datatype. You can do this a row at a time, eg:
Worksheets("MySheet").Range("A:A").Value
= Worksheets("MySheet").Range("A:A").Value

Resources