+ Reply to Thread
Results 1 to 2 of 2

Macro Converts Fractions Into Dates

Hybrid View

  1. #1
    Registered User
    Join Date
    01-11-2011
    Location
    oklahoma, united states
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro Converts Fractions Into Dates

    In a "Bill of Materials" spreadsheet, I am trying to create a macro that will calculate weight. One of the cells will have an entry like: PL. 1/2"X12". My macro uses both dimensions in this entry as well as a few other cell values. I know that I can put a "0 " in front of the fraction, but that creates two other problems: if the fraction is greater than 1" (1 1/2" becomes 0 1 1/2") it fails, and I can't persuade the key people here to allow the BOM to have a "0 " in front of fractions. So my question is, is there a way to prevent XL from converting fractions into dates in a macro besides adding a "0 "?

    =VALUE(TRIM(SUM(SUBSTITUTE(SUBSTITUTE(LEFT(D32, FIND("X", D32,1)-1),"""",""),"PL. ","")+0))) * VALUE(TRIM(SUBSTITUTE(MID(D32, FIND("X",D32,1)+1, 5),"""",""))) * (C32) * (F32+(E32*12)) * 0.2836

    Most of this macro is dedicated to isolating the two dimensions in the description (D32) (PL. 1/2"X12")

    Thank you for any suggestions,

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro Converts Fractions Into Dates

    You refer to Macros but are posting a Formula - from a formula perspective you might try adapting along the lines of:

    =(REPT("0 ",ISERR(SEARCH("* * */*",D32))) & REPLACE(SUBSTITUTE(LEFT(D32,FIND("X",D32)-1),"""",""),1,FIND(" ",D32),"")) * SUBSTITUTE(REPLACE(D32,1,FIND("X",D32),""),"""","") * C32 * (F32+(E32*12)) * 0.2836
    Note - given the multiplication taking place the use of VALUE is unnecessary as both sides will coerce automatically.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1