+ Reply to Thread
Results 1 to 19 of 19

Formula not working in a newly inserted row

  1. #1
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Formula not working in a newly inserted row

    This is my formula

    =IFNA((VLOOKUP(D2,ProductCost,2,FALSE)*E2)+VLOOKUP(C2,ServiceCost,2,FALSE)-VLOOKUP(C2,ServiceCost,2,FALSE)*VLOOKUP(F2,Discount,2,FALSE)+G2,0)

    It works perfectly the way I want it to.

    I can copy the formula into the next row and the formula continues to work properly.

    BUT once I insert a new row (There are cases where I need to insert a row between 2 rows and not just add a row) the formula does not work. The formula appears to copy properly including changing the row numbers correctly but it doesn't actually make the calculation!

    What is going on???
    Attached Images Attached Images
    Last edited by Brenda H; 09-05-2015 at 09:16 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Formula not working in a newly inserted row

    Sounds as though Calculation is set to Manual.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    On the newly inserted rows I can clear every aspect of the cell, manually type in the correct formula and it still will not work.....

    Just checked the calculation mode, it's set to automatic.
    Last edited by Brenda H; 09-05-2015 at 09:27 AM.

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula not working in a newly inserted row

    When you say "does not work" do you mean that the result is an error or something like 0 when you expect a different value?

    Outside of the calculation being set to manual as suggested by Trevor (I think that he is most likely correct), are there values for the inserted rows to pick up in columns C to G? You are not clear when you say that you are inserting rows if those columns also have inserted rows at the same time. If that is the case and there are no values in the inserted rows in columns C to G the references would fail when addressing new rows inserted in those columns unless they were populated with appropriate values. If the formula when copied into the new rows actually points to values in the columns C to G then I think that Trevor is correct.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    Here is the screen shot on what I believe to be the area that confirms that the calculations are automatic. Is that correct?
    Attached Images Attached Images

  6. #6
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    This is a screen shot of the cells that have the formula working just fine with the provided data. I have it so you can see the formula, everything at this point is still appearing to work just fine.
    Attached Images Attached Images

  7. #7
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    Now On this screen shot I inserted a row just above row 12. The data in columns B and D copied over without a problem. The formulas in Columns I and J didn't copy any data. Rows 12 and down did not get messed up
    Attached Images Attached Images

  8. #8
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    Because the formula did not copy automatically I copied the formula again from cell I10, pasted it into cell I11. And now I get that #N/A message. There is data to pull up just like all the other cells and if you look at the formula it appears to actually have copied correctly. But why is it not calculating the formula?? It only does this on the inserted rows, no where else.
    Attached Images Attached Images

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Formula not working in a newly inserted row

    Pictures paint a story but there's not a lot we can do with them to help diagnose the problem.

    Can you post a sample workbook with any sensitive information removed.

    Regards, TMS

  10. #10
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    I removed the sheets that contained my banking info, but those did not have anything to do with the sheet 'Income'
    Attached Files Attached Files
    Last edited by Brenda H; 09-05-2015 at 01:31 PM.

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula not working in a newly inserted row

    The values being looked up with the VLOOKUP was returning a #N/A. Rather than have a blank lookup value in the lookup range, eliminate that and amend the VLOOKUP function to include an error trap which returns 0. I deleted the blank values at the top of each of your named ranges then included the error trap. Now, a new row can be inserted and the formula filled down without problem.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Formula not working in a newly inserted row

    @newdoverman: good spot. Took a while to cotton on to that myself (even after you spelt it out)

    Slightly shorter formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    @Brenda: is there a specific reason you seem to force 8 pages? That seems to go against the fact that a) you add rows at the bottom and b) you want/need to insert rows.

    All things being equal, I'd recommend that you convert the data to a Structured Tables. That will maintain the formula, formatting, Conditional Formatting and Data Validation. Incidentally, given that you have tables set up, it would make sense to use them for selecting Service, Product and Discount.

    Regards, TMS

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula not working in a newly inserted row

    @TMS
    I starred at that for a long time before I had the "ah crap" moment, why didn't I think of that sooner!

  14. #14
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    I forced the pages because I was so frustrated trying to figure out the right way to get that formula to copy into a inserted row.

    On the income sheet I want to record each massage session that the whole company does on a daily bases, The individual employee sheets (Brenda, Jonathon, Lydia...) are supposed to calculated the earned commission for that given therapist in a given range, i.e the pay period. That's why I was "inserting" rows as there is no way I can predetermine how many sessions will be done in a given pay period. Now I'm wondering if I could have the formula on the individual therapist sheets pull information from a range that's by dates......

    I'm learning much about excel...

    I'm going to see if I can make since of your suggested formula then maybe play around with my new idea! Thanks for the help.

    Brenda

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Formula not working in a newly inserted row

    Hi Brenda

    I would recommend a) don't have separate sheets for each of the therapists and b) have a single sheet where you record all the data AND convert that to a Structured Table. Excel manages the ranges in a Table and, as I said before, new rows will automatically carry forward formulae, formatting, Conditional Formatting and Data Validation. They also include in-built filtering and sorting. So, you can, for example, sort the data by date AND filter out one or more of the therapists for printing, etc.

    Oh, and the reason for having one sheet: one day you will want/need to compare, contrast and analyse the data. In one sheet, it's easy. In lots of sheeted it's a PitA

    Regards, TMS

  16. #16
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    Thank you both, it's working!!!!!

    I'm going to look more into Tables next, thank you again!

  17. #17
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula not working in a newly inserted row

    Here is an example of using a table for your data input on the Income worksheet and on the Summary worksheet, an example Pivot Table using the data from the table on the Income worksheet.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    09-05-2015
    Location
    North Carolina
    MS-Off Ver
    Office 2013
    Posts
    33

    Re: Formula not working in a newly inserted row

    Thank you for that, those pivot tables look like they are worth learning more about. Again thank you for your help

  19. #19
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Formula not working in a newly inserted row

    You're welcome. Thank you for the feedback.

    Remember TMS' suggestion in message 15

    "Oh, and the reason for having one sheet: one day you will want/need to compare, contrast and analyse the data. In one sheet, it's easy. In lots of sheeted it's a PitA "

+ 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. [SOLVED] Put Formula in newly inserted cells
    By sunjam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-01-2014, 02:51 AM
  2. [SOLVED] Macro/VBA to keep formula in newly inserted row
    By Antligen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 06:32 AM
  3. Add Default Value from Dropdown of Newly Inserted Row
    By Jasonsan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-29-2013, 02:08 PM
  4. [SOLVED] Create a Macro to paste formula into newly inserted row
    By simple? in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-27-2013, 04:47 PM
  5. [SOLVED] How to use variables in newly-inserted columns?
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2013, 07:45 AM
  6. Formula to span newly inserted columns?
    By mikep7779 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-10-2010, 09:44 AM
  7. [SOLVED] Naming a newly inserted sheet using VBA
    By Ant in forum Excel General
    Replies: 2
    Last Post: 10-05-2005, 09:05 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