Results 1 to 2 of 2
  1. #1
    halabis is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    44

    Exporting formula to Excel

    I am working on converting an excel spreadsheet into an access database, and one of the fields in the spreadhseet does an MROUND on another. I need to be able to export an MROUND function to excel so that other users can simply hit a button and have their output spreadsheet formatted properly.




    The solution i have hit on is to have access manipulate the date until it is in the proper format for an excel MROUND.

    My Access query performs the following formula

    HoursMissed: "=mround((" & [MinutesMissed] & "/60),.25)"

    and returns a field in the table that looks like this in the datasheet view

    =mround((14/60),.25)


    Now, my thought is that when I export this to excel it will retain the exact text and thus will be a formula the excel can then use. However that is not what happens. The output on excel looks is just ".23" I find this incredibly odd. Intuitively I would think that it would be "=mround((14/60),.25)" My first thought was that during the export process excel is executing the formula instead of simply copying over the table's value. However that can't be the case as the excel output for the formula is ".2333333333" etc. Access cant be executing the formula as mround means nothing to access. What in the world is going on here?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,921
    Since the export procedure is definitely somehow evaluating the expression, have to accept that reality.

    AFAIK, if you want to set a cell to a formula, requires code. Example:

    Code:
    For i = 1 To 167
        For intCCount = 2 To 7
            Cells(intRCount, intCCount + 1).Select
            ActiveCell = "=IF(Results!$" & strCol & "$" & intRow & "=0, " & Chr(34) & Chr(34) & ", Results!$" & strCol & "$" & intRow & ")"
            intRow = intRow + 1
        Next intCCount
        intRCount = intRCount + 40
        intCCount = 3
        Cells(intRCount, intCCount).Select
    Next i
    Why would you want to pass a formula that has constants and no dynamic cell referencing? Why not just the calculated value?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  2. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  3. set excel formula from access vba
    By trevor40 in forum Programming
    Replies: 16
    Last Post: 11-26-2014, 07:32 PM
  4. Anyone able to translate a formula from excel?
    By dniezby in forum Programming
    Replies: 10
    Last Post: 05-21-2013, 01:10 PM
  5. Replies: 10
    Last Post: 12-28-2012, 02:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums