+ Reply to Thread
Results 1 to 12 of 12

Clean up If/Then formula, adding in "isblank" range

  1. #1
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Clean up If/Then formula, adding in "isblank" range

    I have written a formula that almost works perfectly... but 1. I am not sure if this is the best way to go about it, and 2. Almost.

    Please Login or Register  to view this content.


    Cells D16:F16 are sometimes blank..... so if they are blank, and C16>70.... then 10.50 should still be returned
    If they are not blank, well then the above formula still stands, well, that is if that is the best way to acomplish this?

    Column C is Weight
    D:F is Length, Width, Height

    If C is over 70lbs, OR the longest side is over 60, or second longest side is over 30, then return 10.50, Else return 0.


    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Clean up If/Then formula, adding in "isblank" range

    what do you want to happen when it is blank? return 0?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    If the range(D16:F16) is blank, and weight(C16) is under 70, then yes, return zero.
    If the range is blank and weight is over 70, then still return 10.50

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Clean up If/Then formula, adding in "isblank" range

    the part that is stuffing it up is median

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

  5. #5
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    Seems to work perfect. Thank you! Is Median the best way to accomplish this?

    Basically i need to look at the largest number, and the second largest number that would occur in columns D:F. The user may not enter those numbers in order..... since there were only 3 numbers to look at, that is why I went with Median....

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Clean up If/Then formula, adding in "isblank" range

    median wont give you the exact number

    if you put 45,1 = median = 23 instead of 1


    if you want second largest number use =Large(D16:f16,2)
    however you need to wrap it with iferror as it will give error if there are no numbers or even if there isnt 2

  7. #7
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    Thank you for the input..... for now, it does seem that Max / Median is working... but i did find one bug.... do you think that "large" would fix it?

    Attached is a copy of the workbook so that you can see the real data on this.

    So if data appears ONLY in one of the cells D:F, the Max/Median calculation is pulling the data from that cell... instead it should ONLY complete the calculation if all 3 cells in D:F have data in them. Otherwise the data it pulls is not correct.

    I tried playing with the IfError statement that you suggested for the cells in column J as well.... but I was not able to get it to work.

    It almost works correctly with the If/Then statement in Column J, but it produces an error when D:F is blank. Would you mind providing help on this as well?
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Clean up If/Then formula, adding in "isblank" range

    Try

    =IF(SUM(D9:F9)=0,0,IF(SUM(MAX(D9:F9),(MEDIAN(D9:F9)*2),(MIN(D9:F9)*2))>130,67.5,0))

  9. #9
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    Thank you! that does get rid of the error displayed when D:F is empty.

    However, If there is data only in say D9, and not in E9 and F9, it is calculating the Max/Median still. Whereas it should only calculate if all 3 are filled.

  10. #10
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    i tried "Product" instead of "Sum" thinking that if not all three cells D:F had numbers in it that a product would return zero... but it does not.

    If number "5" is a number say in cell D9, E9 and F9 are blank.... Product(D9:F9) will return "5"

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Clean up If/Then formula, adding in "isblank" range

    This checks if D:F is all cells have data and returns ) if false

    =IF(COUNTA(D6:F6)<>3,0,IF(SUM(MAX(D6:F6),(MEDIAN(D6:F6)*2),(MIN(D6:F6)*2))>130,67.5,0))

  12. #12
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    Re: Clean up If/Then formula, adding in "isblank" range

    PERFECT!! Thank you!

+ 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] Code Clean-Up: Delete "False" worksheet created when "Cancel" is chosen in Input Box
    By Kenny Blackwell in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 08-31-2015, 10:00 AM
  2. Replies: 7
    Last Post: 06-29-2015, 11:44 AM
  3. [SOLVED] IF formula not working =IF(NOT(ISBLANK(M3)),"",IF(ISBLANK(L3),"",TODAY()-L3))
    By amthyst826 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2014, 02:37 PM
  4. solution for the blank cell using the IF function
    By ragnaedge in forum Excel General
    Replies: 4
    Last Post: 08-23-2013, 11:03 AM
  5. Formula for adding week-end "idle time" to date range
    By bradlessard in forum Excel General
    Replies: 2
    Last Post: 02-12-2012, 11:30 PM
  6. [SOLVED] Utility to "clean up" or "defrag" large Excel file
    By Sabrina in forum Excel General
    Replies: 3
    Last Post: 01-12-2006, 06:00 PM
  7. [SOLVED] "Clean Me" Macro is giving "#VALUE!" error in the Notes field.
    By Ryan Watkins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2005, 08:05 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