“Be angry and do not sin; do not let the sun go down on your anger . . . Let all bitterness and wrath and anger and clamor and slander be put away from you, along with all malice." (Eph 4:26; 31, ESV)
Paul says in Ephesians 4:26 to be angry but do not sin yet in verse 31 he says to put away anger! What gives here? He seems to endorse anger then moments later prohibit it. Are there circumstances in which anger righteous and holy (v. 24) and circumstances in which it is sinful? Apparently. Then how do we determine when it is ok and even good and when it is not ok and sinful? This is where we let the whole counsel of God, all of Scripture, speak to a particular Scripture. If we look at the Old Testament for examples of righteous anger we see Moses coming of his mountain top experience with God only to find the people of Israel reveling in idolatry. While he was up the mountaintop receiving the ten commandments, the people of Israel, under the leadership, or lack of leadership of Aaron, had created their own god (Ex. 32). That was righteous indignation, holy and righteous anger displayed by Moses. Yet later when Israel was angry with Moses because of the discomforts of freedom, God tells Moses to speak to the rock to bring forth water for Israel and their cattle to drink from. Yet Moses in his anger disobeys God's instruction and is prevented from entering the promised land (Num 20:1-13). Moses let his righteous anger get the best of him and disobeyed God.
Moving to the New Testament, we find Jesus angry with the Jewish leaders for making the temple a place for profit at the expense of the the worshipping community (Mat 21:12-17). He overturns the tables and lectures them for hindering the worship of Gods people. An example of holy and righteous anger with appropriate actions. Lastly, in Mark three the Jewish leaders, looking for an opportunity to accuse Jesus, see if he will heal on the Sabbath. Work in their mind but not really as Jesus only spoke and the healing was the work of God. When he asks them if it is lawful to heal on the Sabbath, they ignore him. He becomes angry and grieved at their hardness of heart then turns and heals the man with the withered hand. Again, his anger is righteous and holy.
So I believe the anger Paul is endorsing in verse 26 is righteous indignation - anger toward the things God gets angry about is good and holy as long as it does not get the best of us and we sin in the moment of anger. That is why he says to be angry but sin not. This verse is not a license to be angry as long as we do not sin in this anger, which is the way I hear some Christians understand this verse.