Is it a sin to be angry with God? What does the Bible say about anger toward Him? Are there exceptions?
There is a time to be angry  and it is when you see an injustice or a violation of the law so there is nothing wrong about getting angry over something that is deplorably wrong. One example is that of a child being abused. God is most certainly angry over this and would expect us to do something about it. Jesus got angry too. Listen to what happened when He saw what the money changers were doing at the temple.
Those who came from far away for the Passover obviously couldn’t bring their sacrificial animals with them like lambs, so they came to the first part of the temple and bought animals for them to sacrifice. What they found were over inflated prices for the sacrificial animals, cheating on currency exchange, diseased or blemished animals, and they exploited the poor who could only afford to buy a sparrow or a dove. When Jesus saw this, He was incensed and He cleansed the temple. There were actually two times that He did this, once at the beginning of His ministry and once near the end of it. In John 2:13-16 we read that “Jesus went up to Jerusalem. In the temple he found those who were selling oxen and sheep and pigeons, and the money-changers sitting there. And making a whip of cords, he drove them all out of the temple, with the sheep and oxen. And he poured out the coins of the money-changers and overturned their tables. And he told those who sold the pigeons, ‘Take these things away; do not make my Father’s house a house of trade.’” Picture this in your mind. Jesus was meek and mild, yes, but He was also firm when there was the need to be. He made a whipping cord, turned over the tables, and ordered these thieves out of the temple. He was not shy about cleansing a place that was supposed to be Holy.
The other account is in Mark 11:15-17 where Jesus “came to Jerusalem. And he entered the temple and began to drive out those who sold and those who bought in the temple, and he overturned the tables of the money-changers and the seats of those who sold pigeons. And he would not allow anyone to carry anything through the temple. And he was teaching them and saying to them, “Is it not written, ‘My house shall be called a house of prayer for all the nations’? But you have made it a den of robbers.”
Be Angry and Sin Not
Paul obviously had heard about Jesus’ confrontation with the “den of robbers.” He also understood that God gets angry at sin. He wrote to the Ephesians to “Be angry and do not sin; do not let the sun go down on your anger” (4:26). What is interesting here is that he said this in an imperative form of the Greek. “Be angry and do not sin.” It is a command. So you can be angry and it not be sin. The point is it isn’t sin when you get angry for the right reason…and if you do get angry, get over it…at least by sundown (Eph 4:26). If you don’t, you open the door for the Devil (Eph 4:27). This doesn’t mean that you need to get rid of the anger at the exact moment that the sun sets. What Paul means is that don’t let your anger linger. Get angry for the right reasons, like in Jesus’ case, and then let this anger subside. Ultimately, God will avenge all wrongs, including those done to His own people (Luke 18:7).
Can We Be Angry at God?
The Old Testament  has an account where David got angry at God but he is not the only one that does. In 1 Chronicles 13:9-11 the Ark was returned to Israel when “Uzzah put out his hand to take hold of the ark, for the oxen stumbled. And the anger of the Lord was kindled against Uzzah, and he struck him down because he put out his hand to the ark, and he died there before God. And David was angry because the Lord had broken out against Uzzah. And that place is called Perez-uzza to this day.” David was angry that Uzzah was killed but the fact is that they were not treating the Ark in the way that it deserved to be treated…with holiness and respect. For one thing, they were moving the Ark, which represented the presence of God, on an ox cart. It was supposed to be carried by priests and by using poles so that no one would touch it. David got angry that someone died from an accidental touching of the Ark but instead he should have realized that they were caring for the Ark in an irreverent manor.
The fact is that David felt forsaken by God (Psalm 22:1) Jeremiah felt deceived (Jer 20) and Job felt abandoned (Job 23:1-15). Maybe you’ve been angry at God. It is okay to get angry at God. God will not strike you dead for that…but the fact is that you should not stay angry at God. Instead of asking God why, we should ask God what. What are you trying to teach me God? To be angry at God is not sin but to remain in a constant state of anger will not solve anything and God deserves our respect, our reverence, and our thanks because He is truly kinder to us than we deserve.
God is angry at sinners and is angry at the sinner every single day (Psalm 7:11). God is so angry at sin, He was willing to have the wrath of God that we deserved placed on His innocent Son, Jesus Christ. He became sin for us and since the wrath of God is evident against sin (Rom 1:18-32), God could not just look the other way. He had to punish wrongdoers but for those who have repented and trusted in Christ, His wrath has been satisfied in Christ, the Passover Lamb of God (1 Cor 5:7). Believe on Him and you will not be condemned on that day of Judgment (Rev 20:11-15) or reject Him and face the full fury of His wrath someday (John 3:36). You have a choice to make. His anger against your sin is appeased in Christ (John 3:16) or you will have to bear it yourself (John 3:17-18).
Related reading: Can a Christian be Angry and Not Sin? 
Resource – Scripture quotations are from The Holy Bible, English Standard Version® (ESV®), copyright © 2001 by Crossway, a publishing ministry of Good News Publishers. Used by permission. All rights reserved.