+ Reply to Thread
Results 1 to 3 of 3

Convert Excel formulas containing functions to a simple form

  1. #1
    Registered User
    Join Date
    09-11-2014
    Location
    Germany
    MS-Off Ver
    2013
    Posts
    2

    Convert Excel formulas containing functions to a simple form

    Hello Everyone,

    I am a beginner with VBA. I want write a macro to convert a formula which contains functions to a simple form. e.g. D12+SUM(E22:E26) should be converted to D12+E22-E26 or D12+SUM(E22:E26)-SUM(F12:F15)-D20+SUM(G12:G14) should be converted to D12+E22+E23+E24+E25+E26-F12+F13+F14+F15-D20+G12+G13+G14.

    I have been trying a lot but no success......Can someone please help me out.......or if someone has already done such sort of thing?

    Any help would be highly appreciated.

    Thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Convert Excel formulas containing functions to a simple form

    Hi, welcome to the forum

    I know this does not answer your question, but I hardly see how...
    =D12+E22+E23+E24+E25+E26-F12+F13+F14+F15-D20+G12+G13+G14
    is simpler than
    D12+SUM(E22:E26)-SUM(F12:F15)-D20+SUM(G12:G14)

    your "simpler" formula is actually in error anyway, if you really wanted to extend it like that, the 2nd SUM is negative, so all those ranges need to be negative as well...
    =D12+E22+E23+E24+E25+E26-F12-F13-F14-F15-D20+G12+G13+G14

    But this could be simplified further...
    =SUM(D12,E22:E26,-F12:F15,-D20,G12:G14)
    ARRAY entered using CTRL SHFT ENTER, not just ENTER
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-11-2014
    Location
    Germany
    MS-Off Ver
    2013
    Posts
    2

    Re: Convert Excel formulas containing functions to a simple form

    Thanks for the correction. Well i need it in this form because it's the requirement to convert it to SAP form. I need to do this in vba......

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert simple cell math formulas to VB
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-07-2010, 08:40 AM
  2. Simple question about FORM / SAVE & EXCEL
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 05:45 PM
  3. Replies: 0
    Last Post: 04-27-2005, 07:06 PM
  4. [SOLVED] RE: Is there a way to convert a EXCEL form into a WORD form?
    By Carole O in forum Excel General
    Replies: 1
    Last Post: 04-27-2005, 06:06 PM
  5. Replies: 1
    Last Post: 01-03-2005, 11:06 PM

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