 Highlighted

# Confused by ' " and & in constructing formula

Hi

I have a formula in D5: (and subsequent rows)

=SUMPRODUCT(SUMIFS(Expend,**bleep**,Data!\$G\$2:\$R\$2,Budget,INDIRECT("Data!M\$"&VLOOKUP(ROW(),CodeMatch,2,FALSE))))

There are about 100 lines in the sheet but the reference to \$G\$2:\$R\$2 is not consecutive so I can't do a pull-down on all the rows. I have the value, in this row, of '2' in column H5. The value in column H will be different for each row. What is the syntax to place the value in column H5 in this formula instead of hard coding it for each row. I've tried the following but none seem to work:

"Data!\$G\$&H5&"/":"&\$R\$"&H5" and about 10 other variations of placing the quotes and & and I have finally kicked the cat for not helping me! Note that the VLOOKUP is returning the value I want to put in the array but I got even more tangled up trying to add the VLOOKUP twice in the array!!!!

2 Replies
Highlighted

# Re: Confused by ' " and & in constructing formula

Please attach your sample Excel file with manually entered results and the logic of each.

Highlighted

# Re: Confused by ' " and & in constructing formula

Attached is the full book. TSB is the income and expenditure. Each row has an analysis code (col H) and a budget code (col T). The Budget sheet consolidates various combinations of analysis and budget, to analyse the whole income and expenditure over individual combination of codes would would be OTT.

Each row of the budget sheet consolidates analysis and budget codes using the data in the data sheet.

If you look at row 20 of the budget sheet the figure of £394.93 is a consolidation of all 'running' costs over  6 analysis codes. It does this by looking up in the data sheet G10:M10 and the analysis codes are IN, AD, PO, SO, OF, ST and the budget code is RUN. I could hard code each row in the budget sheet formula (see example of this in the P & L sheet) but I want to let different clients change what each budget figure should contain. In the Data sheet I have indicated which row it should use, N10 in that sheet tells me the row on the budget sheet is row 20. I have also reversed this, H20 in the budget sheet tells me it is row 10 on the Data sheet. I want the value in H20 in the formula in Budget!D20, you will note the row is absolute. I want it to pick up the value in H20 and put it in the Data!\$G10:\$R10 part of that formula. This is a good example, obviously I will start at row 5 of the budget sheet and pull down. Hope that helps (maybe drive you nuts but....)

David