You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- RE: Excel 2003 - Large function that excludes bold cells

Advertisement

Sorry I didn't include enough info on my original request. I was looking at this VBA code from one of your older posts on the site:

http://en.allexperts.com/q/Excel-1059/2011/2/Average-Colum-excludes-Bold.htm

I guess my question now is, should I change the part of the code that you wrote from FontBold to ExcludeBold?

I'm trying to count the 10 largest numbers in a column. The column also has subtotals I want to exclude from the large funtion. Those subtotals are in bold, so I was hoping to find some kind of code that would incoporate the large function, while excluding bold entries in the column.

Thanks.

Caroline

If you want to use that function, then that would be OK. Since it returns true if the cell is bold, then you would next it in the NOT function. So if I wanted to work on A1:A40, I could put in the formula

=LARGE(IF(NOT(FontBold($A$1:$A$40)),$A$1:$A$40),1)

entered with Ctrl+shift+enter rather than just enter.

If I wanted to get a sorted list of the numbers from largest to smallest, in the first cell I would put.

=LARGE(IF(NOT(FontBold($A$1:$A$40)),$A$1:$A$40),ROW(A1))

again using Ctrl+shift+enter, then select that cell and drag fill it down the column for as far as necessary.

as you drag down the function, the row(A1) which returns a 1 will change to row(A2) and return a 2 and so forth. This is just a trick so you can provide the second argument to the Large function.

by using the IF construct in the first argument to LARGE, then values that are in bolded cells are seen as containing False and are ignored by the LARGE function.

there is no need to rename the function - the example I was giving was just that. I used made up names just to illustrate what I was talking about. Now that you show me the actual function, then you can just use that name (FontBold). \

This was tested and worked for me.

(the FontBold code should be put in a general module. In the Visual Basic Editor, choose Insert=>Module and put the code in that module. Don't put it in the sheet module (right click on the sheet tab and select view code - don't use that one).

--

Regards,

Tom Ogilvy

- Add to this Answer
- Ask a Question

Rating(1-10) | Knowledgeability = 10 | Clarity of Response = 10 | Politeness = 10 |

Comment | No Comment |

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Extensive experience. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.