How to format fantasy currency in Microsoft Excel? - excel

In the Format Cells dialog of Excel, where you can create custom numbers, how do I format modern American currency to look like fantasy currency? Instead of dollars, dimes, and pennies, I need it to show gold pieces, silver pieces, and copper pieces (gp, sp, cp, respectively), while also excluding any that results in 0.
Some examples of the desired output:
$25.85 = 25gp 8sp 5cp
$75.50 - 75gp 5sp
$1,000.00 = 1,000gp
Does that make any sense?

This seems to do what you want according to your sample data.
=TRIM(TEXT(INT(A2),"0 \g\p ")&IF(--RIGHT(TEXT(A2, "0.0")),TEXT(--RIGHT(TEXT(A2, "0.0")),"0 \s\p "),TEXT(,))&IF(--RIGHT(TEXT(A2, "0.00")),TEXT(--RIGHT(TEXT(A2, "0.00")),"0 \c\p "),TEXT(,)))
Actually, that formula can be improved to,
=TRIM(TEXT(INT(A2),"0 \g\p ;;;")&TEXT(--RIGHT(TEXT(A2,"0.0")),"0 \s\p ;;;")&TEXT(--RIGHT(TEXT(A2,"0.00")),"0 \c\p ;;;"))

Related

How do I use different currencies VBA [duplicate]

I want to format all cells of a column. The data is a number and I want to add a decimal from left keeping only two digits after that. Then format it as per currency standards. For eg:
Data: Output:
10000 100.00
112233 1,122.33
123456789 1,234,567.89
The requirement is normal and output is in italics.
The following will format a given column as Currency:
Sheets("Sheet1").Columns("A").NumberFormat = "£#,##0.00"
Macro recorder is a bit dangerous in this case, because if you use it, your code would look like this (from the other answer):
Sheets("Sheet1").Columns("A").NumberFormat = "£#,##0.00"
However, this is only ok in UK. If you want to write code, which formats currency based on the local settings of the PC, then it is a good idea to use the currency there:
Sheets("Sheet1").Columns("A").Style = "Currency"
Then a UK person would get pounds format and a US one dollars.

Removing INDIRECT from dynamic column selection

I have researched thoroughly before posting and still can't figure this out.
I currently have a file that uses an INDIRECT logic to gather information from one worksheet to a summary worksheet. The file works perfectly as is. But I'm trying to make it more efficient as right now calculating times are huge due to so much volatility.
In the data worksheet I have a lot of columns, each with a concept and an account number assigned to it.
So, for example:
5014255 5324232 5566544
Name Store Salary Taxes Other Benefit P1 Weight P2 Weight
John Main 222222 50000 30000 0.4 0.6
Jane Annex 222224 50002 30004 0.3 0.7
Then in the summary page, I use a SUMPRODUCT to gather the information per store per account and separating by period, like this as:
Store Account Concept P1 P2
Main 5014255 Salary 88888.8 133333.2
Main 5324232 Taxes 20000.0 30000.0
Main 5566544 Other Benefit 12000.0 18000.0
Annex 5014255 Salary 66667.2 155556.8
Annex 5324232 Taxes 15000.6 35001.4
Annex 5566544 Other Benefit 9001.2 21002.8
This of course is just a basic example. The real file has several more validations and several categories of weights that are used for different accounts. In order to pull the information I have the following formula.
=IFNA(SUMPRODUCT(
INDIRECT(INDEX("'Sheet1'!"&ADDRESS(6,COLUMN($A$5)+MATCH($N5,Sheet1!$1:$1,0)-1,4)&":"&SUBSTITUTE(ADDRESS(1,COLUMN($A$5)+MATCH($N5,Sheet1!$1:$1,0)-1,4),"1","")&$AU$1,1,1)),
--(Sheet1!$C$6:$C$1754=2018),
--(Sheet1!$J$6:$J$1754=$I5),
IF($G5=1,Sheet1!$BN$6:$BN$1754,IF($F5=1,Sheet1!$BA$6:$BA$1754,Sheet1!$AN$6:$AN$1754))
),0)
The important piece of code is:
INDIRECT(INDEX("'Sheet1'!"&ADDRESS(6,COLUMN($A$5)+MATCH($N5,Sheet1!$1:$1,0)-1,4)&":"&SUBSTITUTE(ADDRESS(1,COLUMN($A$5)+MATCH($N5,Sheet1!$1:$1,0)-1,4),"1","")&$AU$1,1,1))
This uses string manipulation to generate the column range according to the account number. So for example, the account number 5014255 would generate Sheet1!$C$6:$C$1754, so that the values in that column can be gathered according to weight and validations.
So, I'm trying to change the logic to remove volatiles. But so far I haven't been able to do it.
I basically need my summary to find the column where the account number is, so it can do the sumproduct calculations with that column.
Any ideas or suggestions on how to work around this?
To get the full column without volatiles use:
INDEX(Sheet1!$C$6:$E$1754,0,MATCH($N5,Sheet1!$C$1:$E$1,0))
This will return the correct column to the SUMPRODUCT formula

Hundred separator in Libre office calc number formating / Indian number formatting

I am moving to Open office spreadsheets and I need to handle large financial values in spread sheet cell.
By default libre office provide NUMBER & CURRENCY format, where "," is used as per Indian Numbering system(refer https://en.wikipedia.org/wiki/Indian_numbering_system )
However, I don't need the number till one's unit place. I need to see number in crore.
26,75,73,350 should be shown as 25.76
Libre office only provide "," as thousand separator. This separator follow US counting system, i.e. millons etc. If used as user-defined format "0.00,,"
I see cell value as 267.57 and not 26.76
What is a good user-defined format following Indian counting system?
I am not sure but try this, N4 contains the value 12345678
=ROUNDUP(N4/("1" &REPT(0,LEN(N4)-2)),2)
Result 12.35
You can changethe bold section with a fixed value 10000 or so
With a formula it would just be a matter of dividing by 10000000 (ten million) and showing decimal places to suit. Unfortunately Open Office Calc (like most other popular spreadsheet programs) does not provide such a format by default. However in a custom format , effectively divides by 1000 (one thousand) and % multiplies by 100 (one hundred) so 267573350 with a User-defined format of:
0.00,,,%
looks like 26.76%. The underlying value is however retained, so for example adding 1 to such a cell (in a different cell of general format) would show 267573351.
That is about as close as I can get just with formatting, but since % (ab)used this way is so open to confusion you might want to give some visual warning by say appending "C" to the format (0.00,,,%"C") to show:
26.76%C

Indexing and Calling Cell information in Excel

Alright so I use excel a lot because of its cross platform functionality and I'm fed up of some of the very long workflows I have to complete for a load of weekly reports I have to do.
I've been experimenting with this for about 2 weeks and I'm not happy with any of it.
I need to input several different reports into a spreadsheet. Except all of the reports the data is in a different order and there is no way to make them all the same format. So what I was hoping to do was to give each product line (theres 170-300 product lines on each report) a numerical value and then have the spreadsheet call the cells from the different pages using its numerical index. Similar to the most basic of tables in C/C++ (the only coding knowledge I have). I have experimented with Vlookup and Address but both cant be used together and address only returns the address of the cell (but there is no way to then get this to read the data out of the cell and then other pieces of information relating to that cell.
If anyone has any ways of helping me out with this then I would be massively appreciative. P.s. To keep this simple all the reports are manually inputted so they all have the same formatting just on different sheets.
You can use INDEX MATCH to match rows and columns,
First Sec Thi
A Apple Orange Banana
B Grape Peach Harambe
C Lime Steve Goat
=INDEX(A:D, MATCH("B",A:A, 0), MATCH("Thi",1:1, 0))
Will return 'Harambe'.

Wrong format of a cell in Excel

I am copying large tables from a website to Excel and it is copied in a wrong format. The number which I need seems to be in a cell but when I click into the cell it shows me that it is a date (and the number shown in the cell is its month and year).
Is it possible to change that so that the number in the cell will be 4.25 instead of 1.4.2025?
Thanks a lot.
You can change the format by highlighting the cells, right clicking selecting the format cells option. It will not change the string of numbers from 1.4.2025, but you will be able to replace the date format with something more appropriate for your needs. *
In the 1900 date system, 1.12 and 12.15 (for example) if entered as 1/12 and 12/15 respectively (where the locale has . as the decimal separator) into cells formatted General will show 01-Dec and Dec-15 respectively. The underlying number however (ie change format from Custom to Number) is 42339 for both. 42339 in Short Date format shows as 01/12/2015.
Although generally possible to deduce what malformed number gave rise to what looks like a date it is not always possible to do so. Ambiguity is greatest where the digits for the decimal or integer parts are less than 13. In addition, the locale in which the numbers were entered may play a part (since, in the 1900 date system, 3/4 for example would be interpreted as 42097 where the date convention is DMY 'UK' and 42067 where the date convention is MDY 'US').
So the answer to your question:
Is it possible to change that so that the number in the cell will be 4.25 instead of 1.4.2025?
is "Yes, but not fully reliably" (and even so would require knowledge or guessing of locale, date system and time of the conversion). Since you are "copying large tables from a website to Excel" it seem you retain access to the source data and I would recommend returning to that. On a small scale manual adjustments may be viable, on a large scale consider importing first to software without such automatic interpretation (eg Word, NotePad++) or, if possible, as character separated values imported as text. Address the delimiters with string handling there and only after that import to Excel or save in Excel format.

Resources