Index Match then average if

SPS123

New Member
Joined
Oct 24, 2018
Messages
2
Hi and thanks in advance in case anyone can help me find a solution. I am trying to combine an index match with an average if. Attached is a screenshot, and the green cells are supposed to calculate the average P/E ratios depending on the timeframe in B4-D4 (1yr-5yr). So for the 5yr (green cell D5) I calculate the average of G5-ZZ5. For 2yr (C5) I calculate the average backwards from 19 Oct 2018 to 25 Oct 2016 with the following formula:

={AVERAGE(IF(G3:ZZ3>=TODAY()-(2*364),G4:ZZ4,"0"))}

--> Calculate the average if the date is between today and two years back


This formula seems to work more or less, but what I am really trying to solve is to combine this formula with an Index-Match or Vlookup, depending on what fits better. There is a dropdown menu in A5 where I can choose between Company 1, Company 2, and Company 3, and I need the cells from B5-D5 to change automatically depending on the company.

Any ideas how to combine the functions?
 

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.
7CGH5CzQ
Picture-Help-mr-excel.png
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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