I am trying to sum Amount Ordered and Extra together and sum stock and gone together. But if any of the columns have no value, I don't want it to do the calculation. I keep getting an error and I don't know how to fix it.
But eventually I am trying to write a function in one line in sheet 2 under Traffic so I can assign a conditional formatting.
So if Sum of Stock and Gone is greater or equal to Sum of Amount Order and Extra it should be 2 or yellow
=If(Inventory!$E$2:$E$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),(Inventory!$F $2:$F$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),">=0"),SUM(SUMIFS(Inventory!$ E$2:$E$7,Inventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),SUMIFS(Inventory!$F$2:$F$7,I nventory!$A$2:$A$7,Sheet2!$A7,Inventory!$B$2:$B$7,Sheet2!$B7),3,2)
Last edited by Jerseynjphillypa; 10-20-2011 at 03:02 PM.
If I understand correctly, you don't want to sum the 2 columns if either is blank... so try:
=SUMPRODUCT(--(Inventory!$C$2:$C$7<>""),--(Inventory!$D$2:$D$7<>""),--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7+Inventory!$D$2:$D$7)
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
Thanks for your help. Your assumption was correct, but I still got a value of 0, it should be blank. Would I use "" at the end of the function
Last edited by Jerseynjphillypa; 10-18-2011 at 03:06 PM.
The best way to get rid of the 0 is to hide it by formatting the result cells as Custom: 0;-0;;@
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
My problem is sometimes 0 can be a valid answer, so if I edit the custom formatting the 0 would not appear
Try:
=IF(AND(INDEX(Inventory!$C$2:$C$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))="",INDEX(Inventory!$D$2:$D$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))=""),"",SUMPRODUCT(--(Inventory!$C$2:$C$7<>""),--(Inventory!$D$2:$D$7<>""),--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7+Inventory!$D$2:$D$7))
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
That's perfect,, how would I change the code, if they provide me a value in one of the columns out of the two to find the sum.
Last edited by Jerseynjphillypa; 10-20-2011 at 01:37 PM.
Perhaps?
=IF(AND(INDEX(Inventory!$C$2:$C$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))="",INDEX(Inventory!$D$2:$D$7,MATCH(1,INDEX((Inventory!$A$2:$A$7=A2)*(Inventory!$B$2:$B$7=B2),0),0))=""),"",SUMPRODUCT(--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$C$2:$C$7)+SUMPRODUCT(--(Inventory!$A$2:$A$7=A2),--(Inventory!$B$2:$B$7=B2),Inventory!$D$2:$D$7))
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
What if there is text in the field. How do I prevent it from saying 0 since that's not a valid value for text. I
I'm using this formula to sum up 4 columns together, two columns together and then comparing their values against one another. How can I run the if statement only if there are sums to add up that is greater or equal to 0.
Last edited by Jerseynjphillypa; 10-20-2011 at 03:12 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks