Forum Discussion
OFFSET nested in COVARIANCE.S returns a #NUM! error
- May 22, 2022
Assuming I understood...
in MATRIX!B2:
=COVARIANCE.S( OFFSET(DATA!$B$2, 0, INDEX(COLUMN(B$1)-2,1), COUNTA(DATA!$A:$A)), OFFSET(DATA!$B$2, 0, INDEX(ROW($A2)-2,1), COUNTA(DATA!$A:$A)) )
If this does what you want and run Excel 2021 or 365 see (in attached file) another option using XLOOKUP instead of OFFSET
I reproduced the spreadsheet but can't post it somehow. Please find below the screenshots. Raw data is in DATA tab and the covariance Matrix is in MATRIX tab.
MATRIX tab
The final result is a Matrix of n*n size that needs to refer to the proper columns in DATA tab.
DATA tab
This is the data tab.
And the formula (in B2) looks like that, but as you can see produce the #NUM! error...
Formula in the matrix cell
Thanks for your help!
Arnaud
Assuming I understood...
in MATRIX!B2:
=COVARIANCE.S(
OFFSET(DATA!$B$2, 0, INDEX(COLUMN(B$1)-2,1), COUNTA(DATA!$A:$A)),
OFFSET(DATA!$B$2, 0, INDEX(ROW($A2)-2,1), COUNTA(DATA!$A:$A))
)
If this does what you want and run Excel 2021 or 365 see (in attached file) another option using XLOOKUP instead of OFFSET
- Arnaud1010May 23, 2022Copper Contributor
- LorenzoMay 23, 2022Silver ContributorGlad I could help Arnaud1010 and Thanks for providing feedback