Skip to content
Advertisement

how to pick the column with the highest value

I have a table with different possibilities of marital status (columns), how do I pick up the one with the highest value and keep the column name?

For example, below is my original data set:

and what i want to see is

Advertisement

Answer

Make an array of the variables to search. Use the MAX() function to find the maximum value. Then using the WHICHN() function to find the index into the array where that value first occurs. Then use the VNAME() function to convert the array reference into the name of the variable.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement