[Dba-office] Excel Formatting question

Gustav Brock gustav at cactus.dk
Tue Sep 19 06:59:52 CDT 2017


Hi John

You need to format both parts as text, then concatenate:

    ThisWorkbook.Worksheets(1).Cells(x, y).Formula = _
        "=TEXT(INT(F3),""0\-"")&TEXT(ROUND(12*MOD(F3,1),2),""0.00"")"

    10-9.50

/gustav

-----Oprindelig meddelelse-----
Fra: Dba-office [mailto:dba-office-bounces at databaseadvisors.com] På vegne af John Bartow
Sendt: 19. september 2017 04:32
Til: DBA Office (dba-office at databaseadvisors.com) <dba-office at databaseadvisors.com>
Emne: [Dba-office] Excel Formatting question

I'm using this formula:
=INT(F3) & "'-" & 12*MOD(F3,1) &""""
To make this (F3): 100.79166666666700
Look like this: 100'-9.50000000000006"

So I add Round()
=INT(F9) & "'-" & ROUND((12*MOD(F9,1)),2) &""""
to get it to look like this: 100'-9.5"

The numbers after the decimal point will be limited to 2 places (because of the data)

How can I get it to always add the 0 after the 5 so that the resulting column figures align? 



More information about the Dba-office mailing list