Lookup data in an inconsistent format

amadeus90

New Member
Joined
Dec 24, 2015
Messages
6
Hi,

So I am having a problem with looking up data in an inconsistent format. Please refer to the attached image for the example. I have company's code, year, and ROA (Return on Asset). Now I want to find ROA at year t-1 of each company, but here is the key constraint:

Some companies have 5 years of data, some have 8 and so on, but not all of them are consecutive (for example company A may have data for year 2003, 2005, 2006, 2007, 2009). I only want to look up and print out those of year t-1 of the same company, or else print out N/A. I have tried if function but yet been success.

URL]


Thank you!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

Maybe you can try something like this in E2 and copy across and down:

Code:
=LOOKUP(
    9.99999999999999E+307,
    IF(
      $B$2:$B$1000 = $B2,
      IF(
        $C$2:$C$10000 = ($C2 - COLUMNS($D$2:D$2)),
        $D$2:$D$10000)))
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,947
Members
449,198
Latest member
MhammadishaqKhan

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