In my worksheet, what is desired is minimum value in Columns I, II and III from years 2017 to 2027 excluding zero. However, from years 2017 to current year i.e. 2023, zeroes should be counted as minimum values and should not be excluded. I am getting the values right using IFS and MIN function but the INDEX function shows the wrong year for Columns II and III but shows the right value for Column I. Please guide me.
Book1 | ||||||
---|---|---|---|---|---|---|
B | C | D | E | |||
3 | Year | I | II | III | ||
4 | 2027 | 0 | 0 | 0 | ||
5 | 2026 | 0 | 0 | 0 | ||
6 | 2025 | 0 | 0 | 0 | ||
7 | 2024 | 0 | 0 | 0 | ||
8 | 2023 | 7 | 0 | 1 | ||
9 | 2022 | 9 | 4 | 0 | ||
10 | 2021 | 4 | 2 | 3 | ||
11 | 2020 | 7 | 3 | 11 | ||
12 | 2019 | 4 | 10 | 6 | ||
13 | 2018 | 1 | 4 | 3 | ||
14 | 2017 | 6 | 1 | 5 | ||
15 | ||||||
16 | 1 | 0 | 0 | |||
17 | 2018 | 2027 | 2027 | |||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C16:E16 | C16 | =IFS(YEAR(TODAY())<2024,MIN(C8:C14),YEAR(TODAY())>2024<2025,MIN(C7:C14),YEAR(TODAY())>2025<2026,MIN(C6:C14),YEAR(TODAY())>2026<2027,MIN(C5:C14),YEAR(TODAY())=2027,MIN(C4:C14)) |
C17:E17 | C17 | =INDEX((Sheet1!$B$4:$B$14),MATCH(IFS(YEAR(TODAY())<2024,MIN(C8:C14),YEAR(TODAY())>2024<2025,MIN(C7:C14),YEAR(TODAY())>2025<2026,MIN(C6:C14),YEAR(TODAY())>2026<2027,MIN(C5:C14),YEAR(TODAY())=2027,MIN(C4:C14)),C4:C14,0)) |