Link to home
Start Free TrialLog in
Avatar of acdecal
acdecal

asked on

Sum cells that have no formula

Hello,
I have data in a ranges (rows) where the cells in the range contain a formula for forecasting.  Users are to overwrite the formula when actual figures are known and I have conditional formatting to highlight the cell.  I would like a formula to sum the actual numbers entered for each row and not include the cells with formulas.  I tried defining a VBA function to test for cell color but it will not pick up conditional formatting changes.

Any help on this please?
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Since the cell is going to be updated to no longer contain a formula...

I would suggest that you just test for the existence of a forumla...

Dim myCell as range

if myCell.HasFormula then....

or

if not myCell.HasFormula then....
Avatar of acdecal
acdecal

ASKER

Is there a non VBA function I can use in a SUMIF ?
I don't believe there is a built in one...

but thinking you could use define it like this in vba:

Function containsFormula(aCellRange As Range) 
    containsFormula = aCellRange.HasFormula 
End Function

Open in new window


Then use =containsFormula in your worksheet or in your sumif function.
Avatar of acdecal

ASKER

I tried =SUMIF(AB10:AQ10,ContainsFormula(AB10:AQ10))  but not working.  Any thoughts?
ASKER CERTIFIED SOLUTION
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
change your formula to make the resulting figure text instead of a number.
=TEXT([formula],"#,###.00")
sum won't add text fields.
Avatar of acdecal

ASKER

That did the trick!  Thanks