ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is there a way to SUM based on formatting of a number? (https://www.excelbanter.com/excel-discussion-misc-queries/44784-there-way-sum-based-formatting-number.html)

timz

Is there a way to SUM based on formatting of a number?
 
I have a column of $ formatted numbers. Some of them are bold and the others
are not. I would like to Sum the column based on whether the bold formatting
is applied or not. Is there a way to do this? (doesn't appear to be)

If there isn't, then let me explain what I am looking for ultimately. I want
to have two totals for this column of $. One that includes everything and one
that includes everything that isn't "marked". Bolding a cell is a really easy
and visual way of marking a cell. Is there some other way I could mark a cell
and is visible and I can conditionally sum the values?

Thanks,
Tim


Peo Sjoblom

You could sum based on formatting if you use VBA, Chip Pearson has some VBA
functions that will sum based on cell color here

http://www.cpearson.com/excel/colors.htm

If you search Google you should be able to find some VBA solutions to "sum
bold fonts"

--
Regards,

Peo Sjoblom

(No private emails please)


"timz" wrote in message
...
I have a column of $ formatted numbers. Some of them are bold and the
others
are not. I would like to Sum the column based on whether the bold
formatting
is applied or not. Is there a way to do this? (doesn't appear to be)

If there isn't, then let me explain what I am looking for ultimately. I
want
to have two totals for this column of $. One that includes everything and
one
that includes everything that isn't "marked". Bolding a cell is a really
easy
and visual way of marking a cell. Is there some other way I could mark a
cell
and is visible and I can conditionally sum the values?

Thanks,
Tim



PeterAtherton



"timz" wrote:

I have a column of $ formatted numbers. Some of them are bold and the others
are not. I would like to Sum the column based on whether the bold formatting
is applied or not. Is there a way to do this? (doesn't appear to be)

If there isn't, then let me explain what I am looking for ultimately. I want
to have two totals for this column of $. One that includes everything and one
that includes everything that isn't "marked". Bolding a cell is a really easy
and visual way of marking a cell. Is there some other way I could mark a cell
and is visible and I can conditionally sum the values?

Thanks,
Tim

A simple function could be

Function BoldSum(rng)
Dim c
For Each c In rng
If c.Font.Bold Then
BoldSum = BoldSum + c.Value
End If
Next

End Function

Copy function into VB Module and use within the book.

Peter Atherton




All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com