I'm trying to set up a sustainable budget excel workbook that I can easily set up the sheets to be named the different categories that I'd like in the summary. The idea is to add the items from the receipts to the different sheet, within their specific category. I'd like to be able to have a formula that separates the dates, and text within the sheet to just get the sum of the numbers within that sheet. Is there an easy way to set up the isnumber formula to exclude dates?
Consider the following UDF():
Public Function SuperSum(shName As String) As Variant Application.Volatile Dim sh As Worksheet, r As Range, v As Variant Set sh = Sheets(shName) For Each r In sh.UsedRange v = r.Value If IsNumeric(v) And Not IsDate(v) Then SuperSum = SuperSum + v End If Next r End Function
User Defined Functions (UDFs) are very easy to install and use:
- ALT-F11 brings up the VBE window
- ALT-I ALT-M opens a fresh module
- paste the stuff in and close the VBE window
If you save the workbook, the UDF will be saved with it. If you are using a version of Excel later then 2003, you must save the file as .xlsm rather than .xlsx
To remove the UDF:
- bring up the VBE window as above
- clear the code out
- close the VBE window
To use the UDF from Excel:
To learn more about macros in general, see:
and for specifics on UDFs, see:
Macros must be enabled for this to work!