+ Reply to Thread
Results 1 to 3 of 3

creating vba script to write semi complex formula across 1000+cells in 1 column

  1. #1
    Registered User
    Join Date
    11-09-2015
    Location
    us
    MS-Off Ver
    2007
    Posts
    7

    creating vba script to write semi complex formula across 1000+cells in 1 column

    I'm entering the home stretch in my project, and the last piece is to tie the various figures together.

    On my master sheet, I have my starting stock for products A and B for each customer and "today's count" which is calculated from here:

    =SUM(F2+DAILY!$AF2+DAILY!$AF3+DAILY!$AF5+SUM(HISTORICAL!$F2:HISTORICAL!$BO3,HISTORICAL!$F5:$BO5))

    This formula takes the starting stock, current regular and custom orders and new stock, historical regular and custom orders and new stock, adds
    them all together and reports what we would currently have. Product B is calculated in a similar manner:

    =SUM(F3+DAILY!$AF3+DAILY!$AF4+DAILY!$AF6+SUM(HISTORICAL!$F3:HISTORICAL!$BO3,HISTORICAL!$F6:$BO6))

    The second customer's formula would be this for product A:

    =SUM(F4+DAILY!$AF8+DAILY!$AF9+DAILY!$AF11+SUM(HISTORICAL!$F8:HISTORICAL!$BO9,HISTORICAL!$F11:$BO11))

    Product B would be

    =SUM(F5+DAILY!$AF10+DAILY!$AF12,HISTORICAL!$F10:HISTORICAL!$BO10,HISTORICAL!$F12:HISTORICAL!$BO12)

    From what i've been able to learn so far (which is just enough to get in trouble :P) an array should help, but i don't really understand how to use them for something like this....

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: creating vba script to write semi complex formula across 1000+cells in 1 column

    Hello dvault101,

    While you describe what happens with the data, you have said what you want VBA to do for you.

    Can you provide a few before and after examples of what VBA should do with these formulae?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-09-2015
    Location
    us
    MS-Off Ver
    2007
    Posts
    7

    Re: creating vba script to write semi complex formula across 1000+cells in 1 column

    Thanks.

    I don't think I'm trying to create a function or do calculations in VBA, more creating a "script". Let me try to explain my goal a different way.

    I want to have excel write formulas to my "today's count" cells (all located in a single column) using predefined lists of values, lets call them X Y and Z.

    I want to assign values of 3,7 and 11 to X
    I want to assign values of 2,5 and 6 to Y
    I want to assign values of 8,9 and 4 to Z.

    For the first cell, I want VBA to write a formula with the first values on each list, so let's say i want to write =sum(Fx+Gy-Hz) where VBA looks up the first value in X (3), Y (2) and Z (8) and the end result that is written to the cell is =sum(F3+G2-H8). In the second cell, I want it to write =sum(F7+G5-H9) and so on.

+ 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. Semi-Complex Vacation Accrual Spreadsheet Template Help
    By epayroll in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-17-2015, 06:51 AM
  2. Replies: 8
    Last Post: 10-15-2013, 02:14 PM
  3. [SOLVED] Complex Vacation Accural Formula/Script needed
    By bioviper in forum Excel General
    Replies: 21
    Last Post: 09-25-2013, 03:47 PM
  4. Replies: 3
    Last Post: 08-08-2013, 07:50 AM
  5. summing up n consecutive cells in a column for 1000 cells
    By Zundah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2013, 10:54 AM
  6. [SOLVED] Formula Convert Digits to Words (1000 write One thousand)
    By Excel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-27-2005, 08:10 AM
  7. [SOLVED] copy column-write a script
    By Kunal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2005, 05:15 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