Index and Vlookup Question

DM_86

New Member
Joined
Aug 15, 2017
Messages
3
Hi All,

I'm hoping someone can please assist me with this (possibly tricky) query:

I have a master sheet and then a report sheet in a single workbook.

Essentially, I want the formula's in the Master sheet, to update automatically based on the report sheet month being updated. Sometimes the alignment of columns in the report sheet changes month to month.

I also need to restrict the rows to only those that have a State or "NSW".

Below is an example of the data, but essentially, I'm thinking that I need to place something along the lines of the following in Cell D2 in order to pull the data from the 'Update' Column in worksheet 'Report - July'

=VLOOKUP(A2,INDIRECT("'"&AJ2&"'!"&"Column D"),2,0)

However, this formula doesn't quite work and also doesn't remove other states. Ideally, this formula would also include a means of updating the prior month automatically within the cell formula (rather than referencing AJ2). This could look something like this (however, I'm not sure how to incorporate this into the above formula):

=CONCATENATE("'Report - "," ",(TEXT(DATE(2004,IF(MONTH(TODAY())-1>0,MONTH(TODAY())-1,12),1),"MMMM'")))

Master Sheet: Called 'Master'

Column AColumn BColumn CColumn DColumn AJ
Row 1
House names

<tbody>
</tbody>
State

<tbody>
</tbody>
Postcode

<tbody>
</tbody>
Update

<tbody>
</tbody>
Row 2
House 3

<tbody>
</tbody>
QLD

<tbody>
</tbody>
4075

<tbody>
</tbody>
Bad

<tbody>
</tbody>
Report - July
Row 3
House 4

<tbody>
</tbody>
QLD

<tbody>
</tbody>
4075

<tbody>
</tbody>
Good

<tbody>
</tbody>

<tbody>
</tbody>

Report Sheet 1: Called 'Report - July'

Column AColumn BAddressColumn CColumn D
Row 1
House names

<tbody>
</tbody>
State

<tbody>
</tbody>
Postcode

<tbody>
</tbody>
Update

<tbody>
</tbody>
Row 2
House 1

<tbody>
</tbody>
NSW
2031

<tbody>
</tbody>
Bad

<tbody>
</tbody>
Row 3
House 2

<tbody>
</tbody>
NSW

<tbody>
</tbody>
2031

<tbody>
</tbody>
Bad

<tbody>
</tbody>
Row 4House 3QLD4075Bad
Row 4House 4QLD4075Good

<tbody>
</tbody>

Report Sheet 1: Called 'Report - August'

Column AColumn BAddressColumn CColumn D
Row 1
House names

<tbody>
</tbody>
State

<tbody>
</tbody>
Postcode

<tbody>
</tbody>
Update

<tbody>
</tbody>
Row 2
House 1

<tbody>
</tbody>
NSW
2031

<tbody>
</tbody>
Bad

<tbody>
</tbody>
Row 3
House 2

<tbody>
</tbody>
NSW

<tbody>
</tbody>
2000

<tbody>
</tbody>
Even
Row 4House 3QLD4075Bad
Row 4House 4QLD4076Bad

<tbody>
</tbody>

Thank you so much, any help is greatly appreciated.

Cheers,

Dave
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try something like this... I did a few tests and got this to look up data off of a sheet name "Report - July"

Code:
=VLOOKUP(A2,INDIRECT(CONCATENATE("'Report - ",(TEXT(DATE(2004,IF(MONTH(TODAY())-1>0,MONTH(TODAY())-1,12),1),"MMMM")))&"'!"&"A:D"),2,0)
 
Upvote 0
Hi mrmmickle1,

Thank you very much; this answer is very close and seems to be on the right track but doesn't quite return the correct result.

If I put this formula in cell D2 it returns the value in the 'Report - July' worksheet but results in cell B2 rather than F2. In other words it puts the state column in the update column.

Apologies if I didn't explain this very well.
 
Upvote 0
You need to change the reference in the Vlookup formula..... 2 = Column 2 which is the State Column.... if you need another column's data just adjust accordingly. In addition you may need to adjust A:D to A:F if you are looking for a value in Column F (Column 6):

Code:
=VLOOKUP(A2,INDIRECT(CONCATENATE("'Report - ",(TEXT(DATE(2004,IF(MONTH(TODAY())-1>0,MONTH(TODAY())-1,12),1),"MMMM")))&"'!"&"[B][COLOR=#FF0000]A:D[/COLOR][/B]"),[COLOR=#FF0000][B]2[/B][/COLOR],0)

maybe this will work:

Code:
=VLOOKUP(A2,INDIRECT(CONCATENATE("'Report - ",(TEXT(DATE(2004,IF(MONTH(TODAY())-1>0,MONTH(TODAY())-1,12),1),"MMMM")))&"'!"&"[B][COLOR=#FF0000]A:F[/COLOR][/B]"),[B][COLOR=#ff0000]6[/COLOR][/B],0)
 
Upvote 0
Thank you very much Matt,

That works perfectly!

Your help is greatly appreciated.

Cheers,

David
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,238
Members
449,093
Latest member
Vincent Khandagale

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