Forum Discussion
Find Highest Value In A Row, Return the column header - across sheets
Hi
I'm trying to return the header that matches the highest value in a row but I'm having some trouble with my formula.
=INDEX(Sheet2!A1:F1,0,MATCH(MAX(Sheet2!A10:F10,Sheet2!A13:F13),Sheet2!A10:F10,Sheet2!A13:F13,0))
thanks
8 Replies
- Patrick2788Silver ContributorIf you're on the Beta channel, use VSTACK to consolidate the data across sheets and then use the formula of your choice to pull the column header.
- SergeiBaklanDiamond Contributor
You may take this Excel formula: Get location of value in 2D array | Exceljet as the basis
- mathetesSilver Contributor
That's an amazing formula, SergeiBaklan I like exceljet and often use it; glad to see you do too.
- SergeiBaklanDiamond Contributor
Dave makes a great job, he systemises all around Excel. Not to explain this and that from scratch usually it's much better to give link on his resource.
- mathetesSilver Contributor
Can you add an image of the array of data in Sheet2? It would help those of us who'd like to help you; otherwise we're not only having to diagnose a formula, but also visualize what it is that said formula is working on. Please, help us help you.
- cheeseontoast101Copper Contributor
mathetes I can't provide the exact image as it's for working purposes.
Below is a similar example of what I'm trying to do. Basically in cell B4 on sheet 1 I want it to reference the header of the fruit that is the best producing in sheet 2. In the example below with the right formula that would produce cherries. (The formula I had originally won't match this, that too was just an example I threw together).
- mathetesSilver Contributor
I've gone ahead and answered my question in the attached spreadsheet. It assumes that, with multiple rows per type of product, your "highest" would be the one with the highest total for all rows, rather than the one with highest individual cell. Here's what it looks like, and the formula (looking for the highest in the totals row) is shown there in the top. It uses the relatively new FILTER function (so you'll need the most current version of Excel).
By the way, since it's possible that two or even three of the columns could end up producing exactly equal totals, the FILTER function will display all three in the cells to the right of the primary display. Try it when you've downloaded the spreadsheet.