+ Reply to Thread
Results 1 to 13 of 13

automatically input formulas in table

  1. #1
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Question automatically input formulas in table

    Hello all,
    I have huge quantities of data in different tables of the same kind.
    These tables don't contain formulas but flat values. I would like to input automatically some formulas in order, when I update a data, to modify accordingly the related total cell.
    The 3 questions are included in the image with an example.
    Thank you for your time and your help !
    Best regards.

    exemple excel.jpg

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    Try this.
    Assumes
    -column headings in row1, with data continuous from row2
    -subTotals and grandTotal in bold
    -no blank rows

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Thank you very much Kevin for your help ! I greatly appreciate it.
    Indeed your syntax works well with the example I gave you (except with subtotal for quantity column but I could sort out this detail following your syntax). But for the real template I use, it is a bit more complex and I struggle a little bit. Maybe you can have a look to it..
    https://www.sendspace.com/file/df339f
    Warmest regards.

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    Can you attach your workbook to your reply.
    Click on reply and
    then click on "Go Advanced" and
    then look below for "Manage Attachments"

  5. #5
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Hello Kevin,

    Please find the excel sheet attached.
    Warmest regards.
    Thierry
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    The attachment is very different from what you asked in post#01
    1. columns are in a different sequence
    2. 4 columns have now become 9 columns
    3. discount column has been added
    4. cell A1 previously was part of the table and now surrounded by blank cells
    5. additional grand total at bottom of table

    Several lines in the macro require amendments. Before I make those amendments can you clarify a few things:

    Column headings - do they always appear in row7, starting in columnB. Can "A1" always be "B7"?
    Please Login or Register  to view this content.
    [CurrentRegion relies on having a table of continuous data to determine the last row - no blank rows or columns]

    Discount column - in the attachment all values are zero. Is this ever used?
    If not used - should the macro delete the column?
    If it is used - please attach an example where there are values in discount column
    [need to amend the calculation for total price to take account of discount if ever used]

    "Total For Fruits" (in row18) - do these words always accompany the Fruit sub-total
    [helpful in identifying where data finishes]

    Final total - the grand total at the bottom of the sheet appears unnecessary - should the macro delete this?
    [the only reason to retain this total would be for combined reporting of "Fruit" plus "non-Fruit" products]
    Last edited by Kevin#; 03-23-2016 at 04:03 AM.

  7. #7
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Hello Kevin, I assume it is more complex than exposed in my first post..

    To answer your questions:

    -> "A1" is ALWAYS "B7". Table headings always start at B7.

    -> Some datas include discount.
    Indeed, discount should be included in the calculation as followed
    On each row including datas, UNIT PRICE (column F) - 15% (example of discount rate) * Qty (column G) = TOTAL (column I)

    -> "Total For Fruits" (in row18) do always accompany the Fruit sub-total

    -> No need to delete the final total line in a macro

    Thank you so much for your help!
    Warmest regards.
    Thierry

  8. #8
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    "If it is used - please attach an example where there are values in discount column"
    I meant please attach a workbook with a valid discount example - when data dumped from elsewhere with %, can often come in as text - so want to make sure it works first time

    thanks

  9. #9
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Displaying discount cells as percentage in the macro would be perfect in the same format you will see in the attached worksheet.
    Thank you Kevin !
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    This is the new code which needs running from the sheet to be modified.
    Attached workbook contains sheet "Data", which is made up of values only.
    To run the macro {CTRL} + t

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Thank you so much once again Kevin! It's almost perfect. There is only a problem with the percentage column:
    The format seems to be wrong as the total cell shows #VALUE!
    I attached the worksheet to this reply.
    Warmest regards.
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: automatically input formulas in table

    That is very peculiar.
    - I opened your file and (like you said) the end column shows #VALUE.
    - Because it is a new file to my system I must click on "Enable Editing" to modify.
    - When I did that all those values became proper numbers

    I have done nothing here to make it work other than apply my own settings to the file.
    - My Excel is treating the percentage correctly , yours thinks it is text (perhaps!)
    - I suspect a minor regional setting difference is causing this.
    - Your Excel is behaving differently to mine. Are you also using Excel2016?

    Try out this modified code . I cannot replicate what happens in your Excel.
    Let me know if it does not work and I will provide a few suggestions as to what you could try.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    03-22-2016
    Location
    Cambodia
    MS-Off Ver
    Office Professional plus 2016
    Posts
    8

    Re: automatically input formulas in table

    Sorry Kevin, I wrote a feedback for your last advise but I found out I never sent it.. It was just fine with the new code no worries.
    By default, it is 0% discount. When I manually change some values, it turns to be a percentage format I can deal with.
    Thank you again for your help ! I really appreciate it.
    Warmest regards.
    Thierry

+ 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. Replies: 2
    Last Post: 11-22-2012, 04:15 AM
  2. hand held scanner that will automatically input data in to a table
    By joparka in forum Access Tables & Databases
    Replies: 1
    Last Post: 08-31-2012, 08:47 AM
  3. Replies: 0
    Last Post: 06-20-2012, 07:46 AM
  4. Automatically Add/Delete rows based on user input but check current table row count
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2011, 11:39 AM
  5. Replies: 0
    Last Post: 08-08-2011, 10:08 AM
  6. Input Cell to create table with input # of rows
    By pgreenway in forum Excel General
    Replies: 3
    Last Post: 05-04-2011, 03:18 PM
  7. [SOLVED] automatically calculate table values via formulas in sheet
    By Montfrooij in forum Excel General
    Replies: 2
    Last Post: 01-24-2006, 04:50 AM

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