Vlookup, Match, Index, Nesting If's....

stilton1

New Member
Joined
Feb 4, 2019
Messages
6
I've been trying to figure out the best way to get data based on a current date and typically use vlookup but it won't allow 12 conditional statements to look at each month. I want to populate based on the current date retrieving from tables from each month assuming the table was extended out all the way to December in the same format.

JanJanJanJanFebFebFebFebMarMarMarMarAprAprAprAprMayMayMayMayJunJunJunJunJulJul....
Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2...
Dep 15512467989562312021548784556892356895612548735684848...
Dep 21256893254879764316532021559487855441122235689895487...
Dep 31346799865322154879764313062958415485926031545789722...
Dep 42558366947142548152536659832124565789885254136755312...
Dep 56655883164975689231559264897643113467982465857545152...

<tbody>
</tbody>


So if it was 1/18/19 I would want to select all values in each department for the month of Jan...or if it was 11/15/19 I would want to select all values in each department for November and fill the table below with that data:

January
Dep 1 55 12 46 79
Dep 2 12 56 89 32
Dep 3 13 46 79 98
Dep 4 25 58 36 69
Dep 5 66 55 88 31


Thanks for any help getting past the nested if limitations with this!

****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
JanJanJanJan

<tbody>
</tbody>
</body>
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You could try doing something like an OFFSET, where the new array uses the month of the date you're in, and the width and height of the array are COUNTIF(row;month) and COUNTA(column), or even hard code them if you want to. This array would be dynamic, changing in accordance with the month you put in. After that you can use an INDEX and a MATCH for each week/ dept in this array you just created
 
Upvote 0
Maybe something like this. Note that your column headers must match the month name (cell A11 must match the headers in row A1 in the example below).
The formula in B12 is an array formula and must be entered with CTRL-SHIFT-ENTER. Then drag the formula down and across as needed. Change ranges to match your data.
Excel Workbook
ABCDEFGHIZAA
1JanJanJanJanFebFebFebFebJulJul
2Wk1Wk2Wk3Wk4Wk1Wk2Wk3Wk4Wk1Wk2
3Dep 155124679895623124848
4Dep 212568932548797645487
5Dep 313467998653221549722
6Dep 425583669471425485312
7Dep 566558831649756895152
8
9
101/18/2019
11Jan
12Dep 155124679
13Dep 212568932
14Dep 313467998
15Dep 425583669
16Dep 566558831
Sheet
 
Upvote 0
I wasn't able to get it to work with the actual tables I created, but when I modified it to fit the layout above it worked perfectly, thank you!!! This seems to be much more effective than some of the coding I've put together which is pretty extensive with over 100 different tabs to automate and this shows I really need to get a better understanding of the index function but for the life of me I can't process for some reason. I sincerely appreciate the help and lesson!
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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