How to sum intermittent cells per cell fill color

MrDB4Excel

Active Member
Joined
Jan 29, 2004
Messages
348
Office Version
  1. 2013
Platform
  1. Windows
I have been searching for the better part of 3 hours to find out how to do this, but nothing seems to give an answer that works.
I have a sheet where I want to get a sum of the numeric values in the cells that contain fill colour index #46 (kind of a burnt orange). These cells are intermittent, meaning the first such cell is A284, the next is A311, etc., etc.
I want the sum to appear in Cell A11 which is a cell in my header.
Obviously, I could do this the long drawn out method as in =sum(a284,a311 etc.), adding the next generated such cell as it happens, but I already have many like this and as I continue working in this sheet I will have many more.
This is not a macro-enabled sheet and I do not want it to become macro-enabled, but to remain a simple *.xlsx workbook.
Any help is greatly appreciated.
I have tried SUMIF, setting conditional formatting, and a slew of other attempts at various other functions, but nothing is getting it right.
I obviously am missing something.
 
Thanks for trying. The fact you never heard of =EXTRACTNUMBERS function available in Kutools tells me there must be something available somehow somewhere to make this work.
I don't give up to easily and if I find something I will let you know.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have never heard of that function, because I do not use the kutools add-in. I simply create my own macros & functions.
It can be done quite easily with a UDF, but that means you either have to make the workbook an xlsm file, which you don't want to do, or create your own macro enabled add-in file.
If you will be the only person using this, you could also add a UDF to your personal.xlsb file
 
Upvote 0
These are things I do not know how to do, but will look into it, thanks
 
Upvote 0
As an example, if you add this to a regular module in your workbook
Code:
Function SumColour(Rng As Range, ClrRng As Range) As Long
   Dim Cl As Range
   For Each Cl In Rng
      If Cl.Interior.Color = ClrRng.Interior.Color Then
         SumColour = SumColour + Cl.Value
      End If
   Next Cl
End Function
You can the use this in the sheet like


Excel 2013/2016
AE
1Store
2133
32
43
54
65
76
87
98
109
1110
1211
1312
1413
1514
Tmp
Cell Formulas
RangeFormula
E2=SumColour(A2:A16,A7)


But you will need to save the workbook as macro enabled.
To install/use macros have a look here https://www.contextures.com/xlvba01.html
=Count
 
Upvote 0
Another thought, are the coloured cells the only cells in col A that contain a formula?
 
Upvote 0
Yes, they contain the formula =EXTRACTNUMBERS(#) where # is the cell address.
 
Last edited:
Upvote 0
In that case it can be done with the help of a "helper" column.
In an unused column enter
=ISFORMULA(A1)
and fill down and then you can use
=SUMIF(D:D,TRUE,A:A)
change the D:D to refer to the "helper" column.
 
Upvote 0
Glad it worked & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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