Using Vlookup to select a range

mawallace

New Member
Joined
Mar 5, 2015
Messages
11
Office Version
  1. 365
Platform
  1. Windows
How would you use Vlookup to select a range?

Look at the table below.

i would like to add up the 12 numbers based on a date entered in another cell.

As an example, if cell C1 has a date of 1/11/21 - i would like Vlookup to add up the 12 figures from the range 1/12/20 - 1/11/21 (giving result 1380) - if C1 has a date of 1/9/21 I would like Vlookup to add up the 12 figures from the range 1/10/20 - 1/9/21) and so on (result 1140)

01/08/2020​
20​
01/09/2020​
30​
01/10/2020​
40​
01/11/2020​
50​
01/12/2020​
60​
01/01/2021​
70​
01/02/2021​
80​
01/03/2021​
90​
01/04/2021​
100​
01/05/2021​
110​
01/06/2021​
120​
01/07/2021​
130​
01/08/2021​
140​
01/09/2021​
150​
01/10/2021​
160​
01/11/2021​
170​
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Book1
ABCD
1DATEValue1-Nov-201380
21-Aug-2020
31-Sep-2030
41-Oct-2040
51-Nov-2050
61-Dec-2060
71-Jan-2170
81-Feb-2180
91-Mar-2190
101-Apr-21100
111-May-21110
121-Jun-21120
131-Jul-21130
141-Aug-21140
151-Sep-21150
161-Oct-21160
171-Nov-21170
Sheet1
Cell Formulas
RangeFormula
D1D1=SUM(OFFSET(INDEX(B2:B17,MATCH(C1,A2:A17,0)),1,0):OFFSET(INDEX(B2:B17,MATCH(C1,A2:A17,0)),12,0))
 
Upvote 0
Thanks - what happens though if the rows had a month missing - say the data had a range of dates, and one (e.g 1/8/21) was missing. Is there a way of saying - select the range 12 months (or nearest) to the date
 
Upvote 0
Thanks - what happens though if the rows had a month missing - say the data had a range of dates, and one (e.g 1/8/21) was missing. Is there a way of saying - select the range 12 months (or nearest) to the date

You are welcome :)

You can use sumifs with 2 criteria
1st Criteria will add 1 month to the date in cell C1
2nd Criteria will add 12 months to the date in cell C1

Excel Formula:
=SUMIFS(B2:B17,A2:A17,">="&EDATE(C1,1),A2:A17,"<="&EDATE(C1,12))
 
Upvote 0
Solution

Forum statistics

Threads
1,214,872
Messages
6,122,025
Members
449,060
Latest member
LinusJE

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
Back
Top