Spilled array formula to match column for minimum of each row in a 2D table

jrhouse5

New Member
Joined
Sep 8, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have a 2D table of timeseries data. I am able to use the following equation in column B: "=BYROW(Value_Array,LAMBDA(x,MIN(x)))" to get the minimum value for each row that results in an array output. In column C the following does not work "=BYROW(Value_Array,LAMBDA(x,MATCH(B6#,x,0)))" to find the column (time period) where the minimum value happened and results in a spilled array.

I very much like the array results because the data table size is always changing, and it is easier to let excel automatically adjust to the correct size as needed. I am sharing with others of varying abilities, so VBA is a no-no.

Is there an excel formula that can match column with the minimum value for each row of the table and results in a spilled range output?
Capture.PNG

I tried using B6# (spilled array) in the match function in column C per the following: =BYROW(Value_Array,LAMBDA(x,MATCH(B6#,x,0))) and expecting a spilled array but get a #CALC! error. If I replace B6# with just B6, the results are a spilled array with only the first row resulting in the correct value and remaining rows with #N/A errors.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Perhaps try
Excel Formula:
=BYROW(IF(Value_Array=B6#,B6#,""),LAMBDA(x,XLOOKUP(TRUE,x<>"",x)))
Your formula is asking excel to check each row for the B6#, which causes the BYROW() result for each row to output an array. Since BYROW() cannot output an array for each row it is checking, you get a CALC# error.
 
Upvote 1
This formula in cell C6 seems to work...
Excel Formula:
=BYROW(HSTACK(B6#,Value_Array),LAMBDA(r,XLOOKUP(TAKE(r,,1),TAKE(r,,-20),E3:X3)))
 
Last edited:
Upvote 1
Oh, if you wanted a match output, replace the B6# in the last formula with either E3:X3 or SEQUENCE(1,COLUMNS(Value_Array)) instead, like:
Excel Formula:
=BYROW(IF(Value_Array=B6#,E3:X3,""),LAMBDA(x,XLOOKUP(TRUE,x<>"",x)))
 
Upvote 1
Solution
Thank you Anonymous1378, the =BYROW(IF(Value_Array=B6#,Time_Array,""),LAMBDA(x,XLOOKUP(TRUE,x<>"",x))) works! Now, I need to try to understand the logic of this equation.
 
Upvote 0
You all had this figured out and, moved on. I lost track of the post and kept working on it when I had time. I had to learn how to use BYROW better...

Here is my solution...
Book1.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1Time Array
21234567891011121314151617181920
3Min ValueTime Array @ MinValue Array
42.8869.9210.9615.8715.0919.382.888.7512.064.655.29.9421.0625.3538.5633.535.932.186.9923.4224.05
519.781324.6439.4924.1538.637.9325.5125.7739.7977.9738.8753.5523.919.78191161.63128.82144.31114.61123.24306
611.53549.7529.4526.0853.9211.5328.4941.8941.765.8555.2924.1220.25112.15101.71122.0653.958.2239.54123.8544.9
70.152014.4936.5725.9918.1748.391.2462.0771.619.4950.3753.1453.3939.9143.2462.4179.812.1973.7813.590.15
84.20448.7119.6910.584.219.5588.0275.1577.99121.5234.9130.04114.9330.86362.95177.2411.0182.31509.51246.58205.13
99.80220.979.817.1979.94126.9977.1567.0642.09276.35308.33342.0254.74188.44212.71199.1792.34873.95238.8661.461,238.98
101.25639.877.6814.1129.5241.341.2523.7191.18126.84115.43140.91109.64101.8487.29396.91348.6416.69418.69339.92525.05
111.18411.9910.098.331.182.3614.5522.723.6216.1928.152.851049.2107.1982.657.1825.1618.89150.48195.75
120.0848.162.974.190.0810.5811.38.545.420.5761.4347.942.266.5134.182.8104.4149.77126.6599.16236.13
Sheet5
Cell Formulas
RangeFormula
A4:A12A4=BYROW(value_array,LAMBDA(x,MIN(x)))
B4:B12B4=BYROW(value_array,LAMBDA(x,MATCH(MIN(x),x,0)))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
value_array=Sheet5!$D$4:$W$12A4:B4

For what it's worth,

Doug
 
Upvote 1

Forum statistics

Threads
1,215,094
Messages
6,123,069
Members
449,092
Latest member
ipruravindra

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