Dates and look ups?

jackdiamond

Board Regular
Joined
Oct 10, 2007
Messages
220
Hi All,

I am hoping to look up some data from another worksheet which changes as today's date changes.

So for example, if it is June, I want it to look up the data that shows for June. If it is July today, I want it to look up the data only from July in my spreadsheet etc etc.

This is my current formula =VLOOKUP(D5,$B$25:$C$39,2,FALSE). This is before I wanted it to show the same month as we are currently in

Any help would be much appreciated

Ta
Jack
 
C D
Jun-12 10
May-12 3
Apr-12 3
Mar-12 2
Feb-12 0
Jan-12 4
Dec-11 0
Nov-11 6
Oct-11 4
Sep-11 2
Aug-11 2
Jul-11 1
Jun-11 2
May-11 0
Mar-11 5
Feb-11 5

b1: =Year(c1)&"|"&month(c1) <---Drop this down the data set.
d1: =vlookup(year(today())&"|"&month(today()),b1:d16,3,0)

^^^Try this (it should return "10")

If you want the user to be able to choose the year/month you can easily do it.
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
ok, this returns data as long as it is an exact date but I want it to look up any date in the current month?

=VLOOKUP(A1,D4:E19,2,FALSE)
This- I hope you mean my last post returns all values that match current month.
We the setup you have posted later and unless the data are formatted as month/year (not a Text) you can try this:

Excel 2010
BCDEF
1Jun-12
2Jun-121010
3May-123
4Apr-123
5Mar-122
6Feb-120
7Jan-124
8Dec-120
9Nov-126
10Oct-124
11Sep-122
12Aug-122
13Jul-121
14Jun-112
15May-110
16Mar-115
17Feb-115
Sheet1
Cell Formulas
RangeFormula
E1=TODAY()
F2=SUMPRODUCT(--(MONTH($B$2:$B$17)=MONTH(E1)),--(YEAR($B$2:$B$17)=YEAR(E1))*($C$2:$C$17))
 
Upvote 0
I have just realised that when my boss looks at the data it will be the next mont, so he will be for example looking at June's data in July!

Is there anyway of changing the formula that I used from post #12 so it looks up the previous month to the one we are actually in!!?

Apologies for changing the goal posts!
 
Upvote 0
Try this.
Two methods(the second is the one you should go with as SUMPRODUCT is rather used for calcualtion)
Excel 2010
ABCDEF
112-Jun
233
312-Jun10
412-May3
512-Apr3
612-Mar2
712-Feb0
812-Jan4
912-Dec0
1012-Nov6
1112-Oct4
1212-Sep2
1312-Aug2
1412-Jul1
1511-Jun2
1611-May0
1711-Mar5
1811-Feb5

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
E2=SUMPRODUCT(--(MONTH($A$2:$A$18)=MONTH(D1)-1),--(YEAR($A$2:$A$18)=YEAR(D1))*($B$2:$B$18))
F2=INDEX($B$3:$B$18,MATCH(TRUE,INDEX(YEAR($A$3:$A$18)&MONTH(A3:A18)=YEAR(D1)&MONTH(D1)-1,),0))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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