Nov 09 2023 11:41 AM
Hi,
I have a table with data. That contains temperatures and dates, but it's not every day. For example:
DATA
1 | A | B | C | D |
2 | Date | Station A Temp | Station B Temp | Station C Temp |
3 | Nov 1 | 1 | 3 | 5 |
4 | Nov 2 | 2 | 4 | 6 |
5 | Nov 3 | 7 | 5 | 3 |
6 | Nov 5 | 8 | 6 | 4 |
7 | Nov 6 | 7 | 5 | 9 |
8 | Nov 9 | 10 | 6 | 8 |
Main Goal: I want to create a formula to pull the minimum temperature between the three stations for a specific date if there is data available (e.g. what's the lowest temperature on Nov 1).
Secondary Goal (Optional): Pull the station associated with the min value.
My set up to populate the table:
RESULT
1 | A | B | C |
2 | Date | Min Temp | Station |
3 | Nov 1 | ||
4 | Nov 2 | ||
5 | Nov 3 | ||
6 | Nov 4 | ||
7 | Nov 5 | ||
8 | Nov 6 | ||
9 | Nov 7 | ||
10 | Nov 8 | ||
11 | Nov 9 |
When I write my formula, I assume I believe I need an INDEX/MATCH to see if the raw DATA has data for that date. For example, Nov 1 has DATA, so my formula should detect that 1 is the minimum value in the row, and my RESULT in B3 should return 1. There is no DATA for Nov 4, so my RESULT in B6 would just be #N/A.
If anyone could provide any ideas, that would be greatly appreciated!
Extra Information
I have done some research and I found two sites that give two different formulas (for my main goal, I haven't looked at my second goal yet).
Option A - It works, but I don't understand a portion of the formula
https://www.exceldemy.com/index-match-minimum-value/
My formula is:
=SMALL(INDEX($B$2:$D$7,MATCH(A12,$A$2:$A$7,0),0),ROWS(A12:A12))
Option B - Couldn't get it to work
https://www.mrexcel.com/board/threads/using-minifs-with-dynamic-row.1124635/
Option C - Seems straightforward, but seems to have some faults
https://superuser.com/questions/1797826/excel-minifs-formula-to-return-another-value-in-the-same-row
My formula is:
=INDEX(B3:I3,MATCH(MINIFS(A2:A4,A2:A4,A11),A2:A4,0))
Thanks in advance!
Nov 09 2023 12:11 PM
Solution=MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),))
=INDEX($C$3:$E$3,MATCH(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),),0))
An alternative could be these formulas for Min Temp and Station. If you want to get rid of the #NA results you can wrap the formula in IFERROR.
=IFERROR(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),"")
=IFERROR(INDEX($C$3:$E$3,MATCH(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),),0)),"")
Nov 09 2023 02:18 PM - edited Nov 09 2023 02:21 PM
Occam's razor - simplest solution is the best. Not sure how I convinced myself I needed MINIFS when MIN works just fine. Thanks!
Nov 09 2023 12:11 PM
Solution=MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),))
=INDEX($C$3:$E$3,MATCH(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),),0))
An alternative could be these formulas for Min Temp and Station. If you want to get rid of the #NA results you can wrap the formula in IFERROR.
=IFERROR(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),"")
=IFERROR(INDEX($C$3:$E$3,MATCH(MIN(INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),)),INDEX($C$4:$E$9,MATCH(H4,$B$4:$B$9,0),),0)),"")