Index Function

ripdaman

New Member
Joined
Mar 11, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
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
BCDE
3YearIIIIII
42027000
52026000
62025000
72024000
82023701
92022940
102021423
1120207311
1220194106
132018143
142017615
15
16100
17201820272027
Sheet1
Cell Formulas
RangeFormula
C16:E16C16=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:E17C17=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))
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi, try this formula for C17
=INDEX((Sheet1!$B$4:$B$14),XMATCH(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,-1))
 
Upvote 0
Hi & welcome to MrExcel.
It's not entirely clear what you are trying to do as this YEAR(TODAY())>2024<2025 is not a valid calculation & the year cannot be greater than 2024 & less than 2025 at the same time.
 
Upvote 0
Is this what you are trying to do
Fluff.xlsm
ABCDE
1
2
3YearIIIIII
42027000
52026000
62025000
72024000
82023701
92022940
102021423
1120207311
1220194106
132018143
142017615
15
16100
17201820232022
Data
Cell Formulas
RangeFormula
C16:E17C16=TOCOL(TAKE(SORT(FILTER(HSTACK(C4:C14,$B$4:$B$14),$B$4:$B$14<=YEAR(TODAY()))),1))
Dynamic array formulas.
 
Upvote 0
Hi, see the linked file for an another solution with simpler functions (INDEX, MAX, MIN, XMATCH)...

The formulas used in the table:
=MIN(($B4:$B14>YEAR(TODAY()))*(C4:C14=0)*MAX(C4:C14)+(C4:C14))
=INDEX($B4:$B14,XMATCH(MIN(($B4:$B14>YEAR(TODAY()))*(C4:C14=0)*MAX(C4:C14)+(C4:C14)),C4:C14,0,-1))

Index.xlsx

Index.png
 
Upvote 0
Solution
Hi, see the linked file for an another solution with simpler functions (INDEX, MAX, MIN, XMATCH)...

The formulas used in the table:
=MIN(($B4:$B14>YEAR(TODAY()))*(C4:C14=0)*MAX(C4:C14)+(C4:C14))
=INDEX($B4:$B14,XMATCH(MIN(($B4:$B14>YEAR(TODAY()))*(C4:C14=0)*MAX(C4:C14)+(C4:C14)),C4:C14,0,-1))

Index.xlsx

View attachment 87321
Thanks for the quick resolution!
 
Upvote 0
Hi, I am very glad that the formulas work.
If I have enough knowledge, I am happy to help at any time.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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