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 does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
7CGH5CzQ
Picture-Help-mr-excel.png
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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