+ Reply to Thread
Results 1 to 5 of 5

to prevent UDF calculation Range is empty

  1. #1
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    to prevent UDF calculation Range is empty

    i have UDF for sum (A2-A1)+(A3-A2)+(A4-A3) + ... So on
    when i am select =adc(A1:A5) result is true
    but while 1 am select adc(A1:A11) result not correct
    A1:A11 is empty
    i has to use if for prevent calculation but not sukses
    help me every body

    Please Login or Register  to view this content.
    res.png
    IN this picture result 40 is true but result -10 not true
    Last edited by daboho; 02-07-2018 at 10:15 AM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,372

    Re: to prevent UDF calculation Range is empty

    Is this the actual calculation, or is this an attempt at something that you feel is representative? Some simple algebra on that expression should show you that sum(for i= 1 to n-1)(a(i+1)-a(i)) simplifies to a(n)-a(1) [50-10 in the example]. Assuming your example is representative, I would be tempted to do away with the UDF and do something like =INDEX($A$1:$A$11,COUNT($A$1:$A$11)-$A$1
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: to prevent UDF calculation Range is empty

    it is only sample my number is variant i want to prevent empty data

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,372

    Re: to prevent UDF calculation Range is empty

    I don't understand your response.

    If this is not the actual calculation you are using, I suggest that you provide a sample of the actual calculation.

    If this is the actual calculation, but you are working with varying numbers of entries, I don't understand why the simpler, non-VBA formula I provided wouldn't work, as it is designed to handle varying numbers of entries in A1:A11.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: to prevent UDF calculation Range is empty

    I can't see the point either, but perhaps
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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] prevent empty rows from printing
    By dill_weed in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-14-2023, 05:11 PM
  2. Prevent pasting if another cell on that row is empty
    By ld2x07 in forum Excel General
    Replies: 2
    Last Post: 10-21-2014, 03:59 AM
  3. How to prevent empty variables
    By Huugin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-23-2013, 08:41 AM
  4. Prevent calculation from changing
    By thmehr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2012, 09:33 AM
  5. Prevent text from being entered, if above cell ist empty
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2012, 04:51 AM
  6. Replies: 5
    Last Post: 04-01-2011, 07:17 AM
  7. [SOLVED] Prevent calculation
    By Pat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2005, 01: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