You are here:

Excel/Excel formula problem

Advertisement


Question
Hi Tom

Using the below as an example, I have 2 tabs on a spreadsheet. Tab 1 has the data below, for 225 cost centres and an ever expanding date range ie we monitor the data daily and a new day is added every day with the old days also remaining, ie, report gets one column larger every day.

The 2nd tab has the 225 cost centres and a single cell in which I specify a date from the previous range.  I need a formula in the cells next to the cost centres which will reference the data in Tab 1 and pull in the data from the other page and put it against the correct cost centre.  IE, if I specify the 5th of December, it will pull in data from the 5th december.  
Because of the number of cost centres I don't want to use an ordinary HLookup.

Tab1
CC   01/12   02/12   03/12   04/12   05/12   06/12   07/12
1   1   1   4   1   3   1   1
2   2   2   2   2   2   2   2
3   5   5   10   3   5   4   5
4   7   7   7   7   7   7   9
5   10   8   7   6   12   5   9

Tab2
CC   05/12
1   3
2   2
3   5
4   7
5   12

I hope you can understand my explanation of the problem.  Any question please let me know.

Answer
B2:  =index(Tab1!$A:$NC,match($A2,Tab1!$A:$A,0),Match($B$1,Tab1!$A$1:$NC$1,0))


This finds row in column A of Tab1 that has the CC designated in cell A2
match($A2,Tab1!$A:$A,0)

This finds the column in Row 1 of Tab1 that holds the date found in B1
Match($B$1,Tab1!$A$1:$NC$1,0)

then

=Index(Tab1!$A:$NC,matching row, matching column)

should return the value you seek.  

You can then copy the formula in B2 down column B next to your values in column A (of tab2)

--
Regards,
Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 About.com. All rights reserved.