ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   display number as feet and inch in single cell (https://www.excelbanter.com/excel-discussion-misc-queries/109365-display-number-feet-inch-single-cell.html)

covdbrdg

display number as feet and inch in single cell
 
How can I display a number as feet and inch in single cell, ie. 8.5 to
display 8'-6"

bigwheel

display number as feet and inch in single cell
 
You could do it with a user defined function e.g.

Function d_to_fi(numberarg As Double)
feet = Int(numberarg)
inches = Format((numberarg - Int(numberarg)) * 12, "#0")
d_to_fi = feet & " ' - " & inches & """"
End Function



"covdbrdg" wrote:

How can I display a number as feet and inch in single cell, ie. 8.5 to
display 8'-6"


Dave O

display number as feet and inch in single cell
 
It can be done with a formula:
=INT(A1)&CHAR(39)&"-"&MOD(A1,INT(A1))*12&CHAR(34)
....but I don't know if there is a way to create a custom format to do
it.


bigwheel

display number as feet and inch in single cell
 
Or you could use a formula:-

=(TEXT(INT(A1),"0")&"' "&TEXT((A1-INT(A1))*12,"0")&"""")

"covdbrdg" wrote:

How can I display a number as feet and inch in single cell, ie. 8.5 to
display 8'-6"


covdbrdg

display number as feet and inch in single cell
 
Thanks, but, How do I create a user defined function?


"bigwheel" wrote:

You could do it with a user defined function e.g.

Function d_to_fi(numberarg As Double)
feet = Int(numberarg)
inches = Format((numberarg - Int(numberarg)) * 12, "#0")
d_to_fi = feet & " ' - " & inches & """"
End Function



"covdbrdg" wrote:

How can I display a number as feet and inch in single cell, ie. 8.5 to
display 8'-6"


covdbrdg

display number as feet and inch in single cell
 
I GOT IT FROM ANOTHER POST... I need to be able to do this in a singlt cell,
like formatting.

"covdbrdg" wrote:

Thanks, but, How do I create a user defined function?


"bigwheel" wrote:

You could do it with a user defined function e.g.

Function d_to_fi(numberarg As Double)
feet = Int(numberarg)
inches = Format((numberarg - Int(numberarg)) * 12, "#0")
d_to_fi = feet & " ' - " & inches & """"
End Function



"covdbrdg" wrote:

How can I display a number as feet and inch in single cell, ie. 8.5 to
display 8'-6"



All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com