+ Reply to Thread
Results 1 to 25 of 25

help to make formula dynamic

  1. #1
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    help to make formula dynamic

    Hello all, I would like help to make these formula's dynamic so they do not return an error when there are empty cells but include new data when added.

    =SUMPRODUCT((Plant=$H15)*(Month=$I$13)*(Year=$J$13))

    =SUMPRODUCT((Plant=$H15)*(Month=$I$13)*(Year=$J$13)*(Alarms))

    Thanks

    Lewster

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: help to make formula dynamic

    Unless the ranges are of different sizes or you have errors within the data or the Alarms range contains text instead of numbers, I don't really see errors coming up.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: help to make formula dynamic

    You can change the formulae to these:

    =COUNTIFS(Plant,$H15,Month,$I$13,Year,$J$13)

    and:

    =SUMIFS(Alarms,Plant,$H15,Month,$I$13,Year,$J$13)

    and then you can define the named ranges Plant, Month, Year and Alarms as full-column references, so that they will include any new data that you add.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Hi, the plant and month are text, year is YYYY and alarms are numbers.
    Lewster

  5. #5
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Quote Originally Posted by Pete_UK View Post
    You can change the formulae to these:

    =COUNTIFS(Plant,$H15,Month,$I$13,Year,$J$13)

    and:

    =SUMIFS(Alarms,Plant,$H15,Month,$I$13,Year,$J$13)

    and then you can define the named ranges Plant, Month, Year and Alarms as full-column references, so that they will include any new data that you add.

    Hope this helps.

    Pete
    Thanks Pete, will these work if data is being pulled from a different workbook without it being open?

    Lewster

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: help to make formula dynamic

    So you mean those named ranges are in a separate (closed) workbook? There was no hint in your original formulae that the data was external.

    You will probably have to include the full path, filename and sheetname to the ranges.

    Hope this helps.

    Pete

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: help to make formula dynamic

    Quote Originally Posted by Lewster View Post
    Hi, the plant and month are text, year is YYYY and alarms are numbers.
    Lewster
    So what errors are you getting? Again, if your ranges are equal size (with blanks or not) then it should not give errors (I think).

    Countifs and Sumifs don't work when referencing closed workbookis.

  8. #8
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Quote Originally Posted by Pete_UK View Post
    So you mean those named ranges are in a separate (closed) workbook? There was no hint in your original formulae that the data was external.

    You will probably have to include the full path, filename and sheetname to the ranges.

    Hope this helps.

    Pete
    Sorry, I was just using these as a sample as I was aware that I would need full address to the workbook and range, I was just checking that they would work on a closed workbook as I think I am right in saying some formula need the workbook to be open to work.
    Thanks very much for your help
    Lewster

  9. #9
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Quote Originally Posted by NBVC View Post
    So what errors are you getting? Again, if your ranges are equal size (with blanks or not) then it should not give errors (I think).

    Countifs and Sumifs don't work when referencing closed workbookis.
    I am wanting to count the number of times a certain plant name occurs in a month in year in the first formula
    In the second I want to count the number of alarms by plant, month, year
    All works well for Jan, Feb, Mar, Apr but for May I get no count at all even though there are entries in for May, the ranges are even and are only at row 200 from a range of 500.
    Lewster

  10. #10
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    I asked for the same help with this formula
    =SUMPRODUCT((Test.xlsx!Plant=$F$2)*(Test.xlsx!Condition=$D5)*(MONTH(Test.xlsx!Date)=MONTH($C$2)))

    and got this which works well
    =SUM(IF(Test.xlsx!Plant=$F$2,IF(Test.xlsx!Condition=$D5,IF(ISNUMBER(Test.xlsx!Date),IF(MONTH(Test.xlsx!Date)=MONTH($C$2),1)))))

    so something along the same line is what I am looking for help to achieve, I just cannot figure out how to adapt my above formulae to achieve the same result.
    Lewster

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: help to make formula dynamic

    Well, that formula implies that the workbook Test.xlsx is open, otherwise you would need the full path etc. Please try to be consistent with your requirements.

    Pete

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    Quote Originally Posted by Lewster View Post
    I asked for the same help with this formula
    =SUMPRODUCT((Test.xlsx!Plant=$F$2)*(Test.xlsx!Condition=$D5)*(MONTH(Test.xlsx!Date)=MONTH($C$2)))

    and got this which works well
    =SUM(IF(Test.xlsx!Plant=$F$2,IF(Test.xlsx!Condition=$D5,IF(ISNUMBER(Test.xlsx!Date),IF(MONTH(Test.xlsx!Date)=MONTH($C$2),1)))))
    I suggested the array formula because the range Test.xlsx!Date had some text entries which caused the MONTH(...) function to error.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  13. #13
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    It was open when I inserted the formula so that it took care of all the path addresses itself but obviously when closed it had the full path address in the formula on Tony's advice.
    Lewster
    Last edited by Lewster; 05-10-2016 at 04:14 PM.

  14. #14
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Still looking for help

  15. #15
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: help to make formula dynamic

    Can you attach the two sample workbooks?
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    What kind of errors do you get?

  17. #17
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Quote Originally Posted by Tony Valko View Post
    What kind of errors do you get?
    Hi Tony,
    I am wanting to count the number of times a certain plant name occurs in a month in year in the first formula
    In the second I want to count the number of alarms by plant, month, year
    All works well for Jan, Feb, Mar, Apr but for May I get no count at all even though there are entries in for May, the ranges are even and are only at row 200 from a range of 500.
    Lewster

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    Quote Originally Posted by Lewster View Post
    I get no count at all even though there are entries in for May, the ranges are even and are only at row 200 from a range of 500.
    Does that mean you don't even get a result of 0? Just a blank cell?

  19. #19
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    It actually has a dash in it if no result but never 0

  20. #20
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    A dash is an accounting format for 0.

    Well, it's kind of difficult to make suggestions without seeing the files to be able to troubleshoot.

    Are you able to post the files?

  21. #21
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    I am afraid not they are on works network and sensitive, I will play around some more and see if i can figure it out.

    Move on and help someone else Tony, thanks for continuing to help.

    Thanks to all for the help given.

    Lewster

  22. #22
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    Here are a couple of common problems to look for...

    Numbers entered/formatted as text. By default numeric numbers are aligned to the right. If you see numbers aligned to the left that's not normal and should be checked into.

    Unseen whitespace characters in the data.

    The underscores represent space characters.

    North_
    _North
    _North_

    You may have a formula that calculates based on "North". If there are whitespace characters obviously they don't match "North" and will cause unexpected results.

  23. #23
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: help to make formula dynamic

    Along with Tony's suggestion. Check the month values. Change the format of the columns containing the dates to number. Real dates will convert to a number. Strings will stay as they are. So if you were looking for "May", it might actually be 5/1/2016 originally formatted as "mmm".

  24. #24
    Forum Contributor
    Join Date
    06-15-2014
    Location
    The great border City of Carlisle, England
    MS-Off Ver
    2010
    Posts
    123

    Re: help to make formula dynamic

    Thank you both for your help, it is now solved, working on dflak's suggestion I checked the raw data and there was indeed numbers instead of text in 1 entry.
    All is good now, thank you again for continued support and help to resolve my issue, you are both gentlemen.

    Lewster

  25. #25
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: help to make formula dynamic

    Good deal. Thanks for the feedback!

+ 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] Make YTD formula dynamic.
    By ammartino44 in forum Excel General
    Replies: 4
    Last Post: 03-25-2015, 01:07 AM
  2. FORMULA TO RANK data in the order 1,2,3,... and make it dynamic
    By SYLVIUS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-20-2014, 05:07 AM
  3. I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2013, 02:41 PM
  4. [SOLVED] I Want to know how I can make this formula into vba code for dynamic cell address
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 12:54 PM
  5. make a sumif formula dynamic
    By amartino44 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-08-2013, 11:19 AM
  6. VLookup formula (how to make it dynamic) in vba
    By david1816 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2012, 10:10 AM
  7. Make dynamic charts more dynamic
    By Milo in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-12-2006, 04:10 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