Using Vlookup to add up several rows

howard

Well-known Member
Joined
Jun 26, 2006
Messages
5,860
Office Version
  1. 2019
Platform
  1. Windows
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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Robert Mika

MrExcel MVP
Joined
Jun 29, 2009
Messages
7,256
Try this
=SUMIF(L1512:L1783,"*DEPRECIATION*",DL1512:DL1783)

as a part of your formula.
 

howard

Well-known Member
Joined
Jun 26, 2006
Messages
5,860
Office Version
  1. 2019
Platform
  1. Windows
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?
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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
Joined
Jun 26, 2006
Messages
5,860
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

Hi Aladin

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

Regards

Howard
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Hi Aladin

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
Joined
Jun 26, 2006
Messages
5,860
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

Hi Aladin

Thanks for the explanation.
 

LearnMeExcel

Well-known Member
Joined
Aug 11, 2009
Messages
728
Hi Aladin
i want to ask u
when i remove the " " from Indirect function it is return Error , why ?
Code:
=SUMIF($L$1512:$L$1521,"*DEPRECIATION*",INDIRECT(DL1512:DL1521))
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Hi Aladin
i want to ask u
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,133,382
Messages
5,658,492
Members
418,447
Latest member
AdamAl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top