If/AND/SUM function with multiple cells and criteria

Wolfieee

New Member
Joined
Jan 3, 2019
Messages
3
Hi,

I am trying to sum up 3 cells. This issue is I want to have them sum when specific text is added into two other cells. Here is the formula I have tried.

=IF($AJ6="M",SUM($AG6:$AH6),IF($AJ6="B",SUM($AF6-($AF6*0.2), $AG6:$AH6), IF(AND(AI6="P",$AI6="N",$AI6="B",$AJ6="M"), SUM($AG6:$AH6,500), IF(AND($AI6="P",$AI6="N",$AI6="B"), SUM($AF5:$AH5,500),IF(AND($AI6="",$AJ6=""),SUM($AF6:$AH6),"")))))

I most of it works. it's when it gets to the IF(AND that it will not work. The last one IF(AND($AI6="",$AJ6=""),SUM($AF6:$AH6) work fine but the other two will just not go. I just can't work out what I'm doing wrong. Any help would be great.

Thanks in advance
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I would say its these parts:

IF(AND(AI6="P",$AI6="N",$AI6="B",$AJ6="M")

IF(AND($AI6="P",$AI6="N",$AI6="B")

AI6 can not be equal to all P and N and B.

Did you mean to use an OR statement in there as well maybe?
 
Last edited:
Upvote 0
Not sure if this helps

AF5=$
AG5=$
AH5=$

AI5= Will have either B, N or P entered. If any of these are entered it needs to add $500
AJ5= Will have M or B in it - If M is entered it will need to add AG5 and AH6 together but not AF5. If B is entered it will need to take 20% off AF5 and then add AG5 and AH5 to the total

if nothing is entered in AI5 then it needs to still do what AJ5 is doing and visa versa

if nothing is entered in both AI5 and AJ5 then it needs to sum up AF5 to AH5

The letters will end being words but for testing, it was easier just to use letters

It did try the Sumif formula but couldn't get it to work.

and yes maybe I should try an OR statement.

It's late maybe my brain is just not working
 
Upvote 0
Would you believe the OR statement worked? :laugh:

Just need to make it a shorter formula now.

Maybe I should stop looking at this screen and get some sleep.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top