J
Joan Edington
Hi,
I have a spreadsheet in which the first column is a budget code,
(columns 2 and 3 are irrelevant to the problem) and column 4 is the
budget that applies to the code. These codes are in the range 1 to
400, in sequence but not necessarily the complete 400 possibilities. I
have defined columns 1 to 4, all rows, as a range called Table.
These codes are logically grouped, sometimes with a range of numbers,
such as all the 80s, and sometimes a few random numbers.
What I need is a summary on sheet 2 with a sum of the budgets for each
code grouping. e.g. one cell may be the sum of all the budgets with
codes in the 80s.
VLookup works OK for a single code but I couldn't find any way of
returning multiple rows to sum without generating a morass of hidden
workings. I simply have too many codes to deal with this.
I then tried to create a VB function that could be used in the summary
cell. This function was meant to loop round VLookups for the desired
code range, adding the results to a variable which I then put into the
function result.
Unfortunately this returns #VALUE!.
I'm just a novice at VB and don't really know if what I'm trying is
possible or if I've just got it wrong. Any other methods would be
gratefully received as well!
Thanks,
Joan
I have a spreadsheet in which the first column is a budget code,
(columns 2 and 3 are irrelevant to the problem) and column 4 is the
budget that applies to the code. These codes are in the range 1 to
400, in sequence but not necessarily the complete 400 possibilities. I
have defined columns 1 to 4, all rows, as a range called Table.
These codes are logically grouped, sometimes with a range of numbers,
such as all the 80s, and sometimes a few random numbers.
What I need is a summary on sheet 2 with a sum of the budgets for each
code grouping. e.g. one cell may be the sum of all the budgets with
codes in the 80s.
VLookup works OK for a single code but I couldn't find any way of
returning multiple rows to sum without generating a morass of hidden
workings. I simply have too many codes to deal with this.
I then tried to create a VB function that could be used in the summary
cell. This function was meant to loop round VLookups for the desired
code range, adding the results to a variable which I then put into the
function result.
Unfortunately this returns #VALUE!.
I'm just a novice at VB and don't really know if what I'm trying is
possible or if I've just got it wrong. Any other methods would be
gratefully received as well!
Thanks,
Joan