# Using Vlookup to add up several rows

#### howard

##### Well-known Member
I need to look up various types of Depreciation , where the values are in column 105 (Col DL) and the decriptions are in col L

I have tried to use the following formula to add all the various depreciation types in Col 105, but cannot get it to add the values

=IF(A69=(RIGHT(A69,50)),VLOOKUP("*Depreciation*",Sheet1!\$L\$1512:\$DL\$1783,105,FALSE))

The various types of depreciation are:

DEPRECIATION-COMPUTER EQUIP
DEPRECIATION Corp Signage
DEPRECIATION-P & M
DEPRECIATION-F & F
DEPRECIATION-OE

your assistance will be most appreciated

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

#### Robert Mika

##### MrExcel MVP
Try this
=SUMIF(L1512:L1783,"*DEPRECIATION*",DL1512:DL1783)

as a part of your formula.

#### howard

##### Well-known Member
Hi Robert

Thanks for the help. The formula works perfectly. However, the values must allways refer to Col DL. Each month a new col is inserted and the values are copied into Col DL. How do I overcome this?

##### MrExcel MVP
Hi Robert

Thanks for the help. The formula works perfectly. However, the values must allways refer to Col DL. Each month a new col is inserted and the values are copied into Col DL. How do I overcome this?
Try...

=SUMIF(L1512:L1783,"*DEPRECIATION*",INDIRECT("DL1512:DL1783"))

#### howard

##### Well-known Member

Thanks for the help, which is much appreciated. What is the purpose of the indirect function i.e how does it work?

Regards

Howard

##### MrExcel MVP

Thanks for the help, which is much appreciated. What is the purpose of the indirect function i.e how does it work?

Regards

Howard
The string it embeds cannot change during copying, etc. INDIRECT resoves the range behind that unchanging string. This enables us to anchor the reference into a fixed address.

#### howard

##### Well-known Member

Thanks for the explanation.

#### LearnMeExcel

##### Well-known Member
when i remove the " " from Indirect function it is return Error , why ?
Code:
``=SUMIF(\$L\$1512:\$L\$1521,"*DEPRECIATION*",INDIRECT(DL1512:DL1521))``

##### MrExcel MVP
when i remove the " " from Indirect function it is return Error , why ?
Code:
``=SUMIF(\$L\$1512:\$L\$1521,"*DEPRECIATION*",INDIRECT(DL1512:DL1521))``
INDIRECT expects a string, not a range. Thus, this function resolves a string to a range whose values it makes available. When given a range, it has nothing to resolve, hence the error.

1,106,404
Messages
5,511,156
Members
408,828
Latest member
Csmnvld

### This Week's Hot Topics

• Turn fraction around
Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
• TIme Clock record reformatting to ???
Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
• TextBox Match
hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
• Using Large function based on Multiple Criteria
Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
• Can you check my code please
Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
• Combining 2 pivot tables into 1 chart
Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...