Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How can I use a UDF in a SUM Function?
I have a UDF (GetLastColNum) which returns the column number of the last
column that has data. I want to be able to sum all the values in a row from column RC[1] to column RC[X] where X is the number returned by the UDF. And I want the total to be updated each time a new column with data is added/removed (ie: X gets increased/decreased automatically). Does anyone know how to do this? Any help is greatly appreciated and I thank you in advance. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How can I use a UDF in a SUM Function?
Hi,
If you use a dynamic named range, you wouldn't need a macro. If your values are in Row 1, your named Range formula would be: =OFFSET(Sheet2!A1,0,0,1,COUNT(Sheet2!1:1)) Then put this into another cell: =SUM(NamedRange) You can add as many numbers as you like to the range, and the Sum will always include them. Regards - Dave. "MrFez" wrote: I have a UDF (GetLastColNum) which returns the column number of the last column that has data. I want to be able to sum all the values in a row from column RC[1] to column RC[X] where X is the number returned by the UDF. And I want the total to be updated each time a new column with data is added/removed (ie: X gets increased/decreased automatically). Does anyone know how to do this? Any help is greatly appreciated and I thank you in advance. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
How can I use a UDF in a SUM Function?
something like
=SUM(A1:INDEX(A:A,GetLastColNum(A:A)) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "MrFez" wrote in message ... I have a UDF (GetLastColNum) which returns the column number of the last column that has data. I want to be able to sum all the values in a row from column RC[1] to column RC[X] where X is the number returned by the UDF. And I want the total to be updated each time a new column with data is added/removed (ie: X gets increased/decreased automatically). Does anyone know how to do this? Any help is greatly appreciated and I thank you in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy of excel file not showing formulal/function in the function b | Excel Discussion (Misc queries) | |||
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) | Excel Worksheet Functions | |||
Offset function with nested match function not finding host ss. | Excel Worksheet Functions | |||
Emulate Index/Match combo function w/ VBA custom function | Excel Worksheet Functions | |||
Nested IF Function, Date Comparing, and NetworkDays Function | Excel Worksheet Functions |