Originally Posted by
OfficeBitty
Hi everyone,
Today, I attempted to apply a lot of the helpful knowledge I have gathered from this forum so far... I had a special need involving fractions, and after fiddling with the formula I got here before, I came up with this:
=IF(MID(TRIM(TEXT(A1, "# ?/?")),2,1)="/",IF(LEFT(TRIM(TEXT(A1, "# ?/?")),1)="1","One "&VLOOKUP(RIGHT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"Onth";2,"Half";3,"Third";6,"Sixth"},2,FALSE),VLOOKUP(LEFT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"One";2,"Two";5,"Five"},2,FALSE)&" "&VLOOKUP(RIGHT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"Onths";2,"Halves";3,"Thirds";6,"Sixths"},2,FALSE)),IF(MID(TRIM(TEXT(A1, "# ?/?")),4,1)="/",VLOOKUP(LEFT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"One";2,"Two";3,"Three";4,"Four";5,"Five"},2,FALSE)&" and "&IF(MID(TRIM(TEXT(A1, "# ?/?")),3,1)="1","One "&VLOOKUP(RIGHT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"Onth";2,"Half";3,"Third";6,"Sixth"},2,FALSE),VLOOKUP(MID(TRIM(TEXT(A1, "# ?/?")),3,1)+0,{1,"One";2,"Two";5,"Five"},2,FALSE)&" "&VLOOKUP(RIGHT(TRIM(TEXT(A1, "# ?/?")),1)+0,{1,"Onths";2,"Halves";3,"Thirds";6,"Sixths"},2,FALSE)),VLOOKUP(A1)+0,{1,"One";2,"Two";3,"Three";4,"Four";5,"Five"},2,FALSE))))
This does exactly what I need it to do, but I guess my first question is: Is there a better way to do what I just did? I'm just starting to figure this stuff out, so I feel like I am going about things the long way around sometimes...
Then comes my next problem. I then had to fit this formula into a sentence in a cell... sort of like "Today's magical Number is [the formula goes here], and what a nice Number it is indeed!" But when added to the sentence, it gave me the "Formula too long" error. So I need to figure out a way to fit this in there... I thought maybe I could make a function that would do all this, so that I could enter "FunctionName(A1)" instead of the whole formula... is that even possible, or am I having confused dreams? I'm doing my best to take in all of the information I can find, but I do get confused easily... In my attempt to make a function that would work for me, I got stuck really quickly where I couldn't get past the point of getting the function to see the fraction as a fraction... it kept treating the fraction like a decimal number (0.3333333). I formatted the cell as "Fractions", and also tried playing with the "Format(---)" thing in VBA, but I think maybe I don't know how to use the "Format" thing in VBA properly... I keep failing, and I'm not sure what I should be doing now... So I have decided to make "cry hopelessly" my Plan B, and my Plan A is to come here and hope that someone can tell me what I should do.
Thank you for taking the time to read my post... I know I ask for a lot of help, but I promise I will keep improving my Excel skills so that I can be the helper some day!
Bookmarks