简体   繁体   中英

Excel , how to find highest column value for a given value from another column

country Initiative 1 Initiative 2 Initiative n Week

Country 1 Status 1 Status 1 Status 1 1

Country 2 Status 2 Status 2 Status 2 1

Country 1 Status 3 Status 2 Status 1 2

Country 2 Status 3 Status 2 Status 2 2

I have an excel file where I collect initiative statuses per country , they are collected per week ( to have a history of initiative evaluation ) I want to build a pivot chart to display the current initiative status by country, but in this table structure ( i cannot change the structure only do modifications in excel ) i cannot do this ( or i don't know how) as initiates are used as headers .

So i wanted to kind of transpose the table into this structure:

Initiative Status Country Week

Initiative 1 Status1 Country1 1

Initiative 1 Status2 Country2 2

Is it somehow possible - i think that transpose excel function will not do what i want.

I wanted to list all initiatives in initiative column and then in column status display the highest status for each country

So i need a function to look into Initiative column and get the highest status for a given country.

Any help appreciated

You can use an array formula for this. It might not be the best solution but it will solve yours specifically. What you do is that instead of making one formula for every row, you have one formula for every row-formula. It's easier to try it yourself.

Let's say your country names are in column A and initiatives in column B. Your array formula would look like

=MAX(IF((A:A)="CountryName"; (B:B); 0))

What this means is IF the row value in A is equal to the name of the country you are looking at, the formula will add the value of column B, the initiative. It will then continue to the next row and do the same for this. Once it has finished the search it will present the highest value of the extracted rows. You may repeat this for every country but I would recommend that you simply take a new sheet, write down all the possible country names in a column and replace the ="CountryName" with a reference to that cell.

EDIT: The important thing is that when you finish writing the formula you must press Ctrl + Shift + Enter, otherwise excel will not understand that it is an array formula.

With a pivot table you can use the column labels in your database as row labels in your pivot chart.

When you choose your database, make sure you select all the existing data, including the labels of the columns (country, initiative, week, etc). When you then choose to create the pivot table you can choose from filters, column labels, row labels and values. If you put the initiatives as row labels you can do this. Another way is to just use the filter function/ribbon which allows you to sort from a number of methods on several columns simultaneously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM