PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, August 13, 2022

[FIXED] How to convert a decimal to a fraction than convert the result to a text?

 August 13, 2022     decimal, excel, fractions     No comments   

Issue

In this case I have a series of dimensions that need to be converted for upload into another database.

21.3 x 16.9 x 14.6

Needs to become

21 5/16 x 16 14/16 x 14 10/16

I can split up the numbers and reformat that into the correct fractions, but this is only for display in that cell. If you click on the cell itself, you can see in the task bar that they remain decimals.

How do I make the change permanent?


Solution

Basicall you will need to save them as text. Use the TEXT formula:

TEXT(A1,"# ??/16")

Which will change the decimal in A1 to a fraction.

To do the whole in one formula TEXTJOIN() as an Array Formula:

=TEXTJOIN(" x ",TRUE,TEXT(--TRIM(MID(SUBSTITUTE(A1,"x",REPT(" ",99)),(ROW($1:$3)-1)*99+1,99)),"# ??/16"))

Being an Array Formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

TEXTJOIN was introduced with Office 365 Excel.

enter image description here



Answered By - Scott Craner
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing