Jmorrison67
Board Regular
- Joined
- Aug 20, 2021
- Messages
- 51
- Office Version
- 2016
- Platform
- Windows
Good afternoon MrExcel community,
Subject: IF function with nested INDEX's & COUNT's
I have tried to search the forum's but can only find IF + COUNT's or IF + INDEX or IF + INDEX MATCH, so hopefully there is no duplication in questions.
I have a fairly complex formula which i am 1. trying to understand and 2. Looking to see if this is the best approach. the formula was set up a few years ago by a colleague who is no longer in the department, so trying to unpick it, is proving a bit of a challenge. I have tried as per below but just not following what all the nested INDEX and COUNT's are actually doing & would quite like to see if there is a simpler way of doing it.
The scenario
There are two results we need to see:
1. 1st year - this is the 1st year but only going back 10 years > so for example Site A started trading in 2009, but we only want data for 10 years, so from 2012 onwards. Then consider Site B - started trading in 2014, so want the formula to pick up the 1st year as 2014. Then consider Site C - started trading in 2016, so want the formula to pick up the 1st year as 2016.
This is the dataset:
I tried to break out each of the INDEX's to work out what they are doing:
The formula feels overly complex - does anyone know if there is an easier solution for it? Hopefully I have added as much data as possible, if you need anything else, then please reach out to me.
2. Last year - this should just be the latest year with values
I have slightly changed the data set just to show this scenario:
Suppose Site C closed at end of 2020 and there is no results in 2021, the formula should then return the 2020 results, but per above it returns zero, which isn't the result we need. Notice the 1st year is also incorrect and returns the 2nd year f trading value.
This is the formula for 'Last Year':
Note: This file will be rolled forward annually and will get new data in it every year.
Any help would be greatly appreciated
Kind regards
Jmorrison67
Subject: IF function with nested INDEX's & COUNT's
I have tried to search the forum's but can only find IF + COUNT's or IF + INDEX or IF + INDEX MATCH, so hopefully there is no duplication in questions.
I have a fairly complex formula which i am 1. trying to understand and 2. Looking to see if this is the best approach. the formula was set up a few years ago by a colleague who is no longer in the department, so trying to unpick it, is proving a bit of a challenge. I have tried as per below but just not following what all the nested INDEX and COUNT's are actually doing & would quite like to see if there is a simpler way of doing it.
The scenario
There are two results we need to see:
1. 1st year - this is the 1st year but only going back 10 years > so for example Site A started trading in 2009, but we only want data for 10 years, so from 2012 onwards. Then consider Site B - started trading in 2014, so want the formula to pick up the 1st year as 2014. Then consider Site C - started trading in 2016, so want the formula to pick up the 1st year as 2016.
This is the dataset:
I tried to break out each of the INDEX's to work out what they are doing:
The formula feels overly complex - does anyone know if there is an easier solution for it? Hopefully I have added as much data as possible, if you need anything else, then please reach out to me.
2. Last year - this should just be the latest year with values
I have slightly changed the data set just to show this scenario:
Suppose Site C closed at end of 2020 and there is no results in 2021, the formula should then return the 2020 results, but per above it returns zero, which isn't the result we need. Notice the 1st year is also incorrect and returns the 2nd year f trading value.
This is the formula for 'Last Year':
Note: This file will be rolled forward annually and will get new data in it every year.
Any help would be greatly appreciated
Kind regards
Jmorrison67