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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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