Delete blank cells containing a formula

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
657
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I want to delete the formula if the cell has no value.
F21:F29 is the range.
F23:F29 should have the formula removed.
thank you.

The Whole Enchilada.xlsm
FGH
20SectorGainStock %
21Tech 3X$ (44.72)-1.87%
22Finance 3x$ 119.609.01%
23 $ - 
24 $ - 
25 $ - 
26 $ - 
27 $ - 
28 $ - 
29 $ - 
Schwab
Cell Formulas
RangeFormula
F21:F29F21=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$9:$B$15)/ISNA(MATCH($B$9:$B$15,$F$20:$F20,0)),1)),"")
G21:G29G21=IFERROR(SUMIFS($K$9:$K$15,$B$9:$B$15,$F21),"")
H21:H29H21=IFERROR(AVERAGEIFS($L$9:$L$15,$B$9:$B$15,$F21),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F21:F29Celldoes not contain a blank value textNO
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
A quick glance at just the picture of the data above seems to indicate all the cells with a dash ($ -) have a value of zero, not an empty value, so that's the first problem.
Second, a cell with a value of "" is not blank, that is if the formula in cell A1 is ="", the formula ISBLANK(A1) will return false.
You need to use the value you are assigning the cell IFERROR which is "". That doesn't clear the contents of the cell which is required for ISBLANK to return TRUE.
It's great that you pasted the sample using XL2BB, but when it references data outside of the range in question, it's of limited use. Having cells B9 to H29 would have been more helpful. I also always forget to check what the top left cell of a sample is and end up pasting it into cell A1. Starting there couldn't hurt either.
 
Upvote 0
I also always forget to check what the top left cell of a sample is and end up pasting it into cell A1. Starting there couldn't hurt either.
I wouldn't recommend this, you just end up having to amend the ranges if the OP tries adjusting them and gets them wrong.
I'd much rather they posted the actual ranges they are using.
 
Upvote 0
Hello,
I want to delete the formula if the cell has no value.
F21:F29 is the range.
F23:F29 should have the formula removed.
thank you.

The Whole Enchilada.xlsm
FGH
20SectorGainStock %
21Tech 3X$ (44.72)-1.87%
22Finance 3x$ 119.609.01%
23 $ - 
24 $ - 
25 $ - 
26 $ - 
27 $ - 
28 $ - 
29 $ - 
Schwab
Cell Formulas
RangeFormula
F21:F29F21=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($B$9:$B$15)/ISNA(MATCH($B$9:$B$15,$F$20:$F20,0)),1)),"")
G21:G29G21=IFERROR(SUMIFS($K$9:$K$15,$B$9:$B$15,$F21),"")
H21:H29H21=IFERROR(AVERAGEIFS($L$9:$L$15,$B$9:$B$15,$F21),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F21:F29Celldoes not contain a blank value textNO
I have a macro that clears the range.
VBA Code:
    Dim rng As Range
    
    Workbooks("The Whole Enchilada.xlsm").Worksheets("Schwab").Select

    Set rng = ActiveSheet.Range("F21")

    Dim I As Long
    For I = 1 To 9
        If rng.Cells(I, 1) = "" Then
           rng.Cells(I, 1).ClearContents
        End If
    Next I
 
Upvote 0
Solution

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top