Thomas Scott
New Member
- Joined
- Nov 7, 2021
- Messages
- 11
- Office Version
- 2019
- Platform
- Windows
I want to use 2 formulas (normalization) and binarization on the same worksheet. I tried concatenating them in a single cell and that does not work so I assume a VBA macro is needed. My thinking, as a novice, is that should be something like this:
Sub Binarize ()
’Dimension the range & specify the worksheet for input
’Primary data will be numbers as well as ranged array
’Binarized data will all be integers or numbers without decimal values
‘ Normalize the worksheet
=(Prime2!B2-MIN(Prime2!B:B))/(MAX(Prime2!B:B)-MIN(Prime2!B:B))
’Binarize the normalized array (mean+/- 1SD for unity)
=IF(AND(Prime2!B2<AVERAGE(Prime2!B:B)+STDEV.P(Prime2!B:B),Prime2!B2>AVERAGE(Prime2!B:B)-STDEV.P(Prime2!B:B)),1,0)
End Sub
BUT do not know enough Excel to go any further. Two sample mini-sheets are shown. I can do it with 3 worksheets easily but just want two, i.e., starting and result. Thanks.
Sub Binarize ()
’Dimension the range & specify the worksheet for input
’Primary data will be numbers as well as ranged array
’Binarized data will all be integers or numbers without decimal values
‘ Normalize the worksheet
=(Prime2!B2-MIN(Prime2!B:B))/(MAX(Prime2!B:B)-MIN(Prime2!B:B))
’Binarize the normalized array (mean+/- 1SD for unity)
=IF(AND(Prime2!B2<AVERAGE(Prime2!B:B)+STDEV.P(Prime2!B:B),Prime2!B2>AVERAGE(Prime2!B:B)-STDEV.P(Prime2!B:B)),1,0)
End Sub
BUT do not know enough Excel to go any further. Two sample mini-sheets are shown. I can do it with 3 worksheets easily but just want two, i.e., starting and result. Thanks.
Sample.xlsx | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | ID | Data1 | Data2 | Data3 | ||
2 | Case1 | 3 | 2 | 3 | ||
3 | Case2 | 1 | 2 | 3 | ||
4 | Case3 | 1 | 2 | 3 | ||
5 | Case4 | 3 | 1 | 1 | ||
6 | Case5 | 1 | 1 | 1 | ||
7 | Case6 | 3 | 1 | 1 | ||
8 | Case7 | 2 | 1 | 1 | ||
9 | Case8 | 2 | 3 | 1 | ||
Prime |
Sample.xlsx | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | ID | Data1 | Data2 | Data3 | ||
2 | Case1 | 1 | 0.5 | 1 | ||
3 | Case2 | 0 | 0.5 | 1 | ||
4 | Case3 | 0 | 0.5 | 1 | ||
5 | Case4 | 1 | 0 | 0 | ||
6 | Case5 | 0 | 0 | 0 | ||
7 | Case6 | 1 | 0 | 0 | ||
8 | Case7 | 0.5 | 0 | 0 | ||
9 | Case8 | 0.5 | 1 | 0 | ||
Analysis |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2:D9 | B2 | =(Prime!B2-MIN(Prime!B:B))/(MAX(Prime!B:B)-MIN(Prime!B:B)) |