sum+if

Vanda_a

Well-known Member
Joined
Oct 29, 2012
Messages
934
Dear all

Could you help me with this issue please?
I would like to sum only the transaction that does not contain "APPLE"
Ex :
NumNameDebitCredit
1APPLE1000sum only Num 2 and 3
1ABC100due to 1 contain "APPLE"
1001900
2ABC1000
2410100
2555900
3Orange1000
3Mango100
3001800
3555100

<colgroup><col><col span="3"><col></colgroup><tbody>
</tbody>

Thank you very much
 
Is this + still needed?
Good morning. I have added an other criteria into inner if but why it works this way and not that way?
IF(('All JL'!$B:$B="BILL")*('All JL'!$F:$F<>"2100030007"),'All JL'!$I:$J))) ---- work
IF(('All JL'!$B:$B="BILL")*(LEFT('All JL'!$F:$F,2)<>"21"),'All JL'!$I:$J))) ----- not work

Thank you
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
IF(('All JL'!$B:$B="BILL")*('All JL'!$F:$F<>"2100030007"),'All JL'!$I:$J))) ---- work
IF(('All JL'!$B:$B="BILL")*(LEFT('All JL'!$F:$F,2)<>"21"),'All JL'!$I:$J))) ----- not work

Forgive the interjection. Just an observation when I stumbled across this discussion, which I am not following.

It is very bad to use whole-column ranges like B:B in formulas like that.

In Excel 2007 and later, it causes Excel to build arrays with 1+ million entries. In this case, Excel will create at least 3 arrays 1+ million entries each concurrently. And each "entry" is multiple bytes, since you have text values. So you will need more than 24 MB to process each of those formulas.

Besides the excess computer memory, processing that much data can slow performance noticeably. It is probably the explanation when users complain that Excel is "not responding".

It is much better to use limited ranges. Even if you do not know how many rows of data you might, you probably know you will not have 1+ million rows; perhaps not even more than 10,000 rows; and perhaps much less. Even B1:B10000 is much better than B:B.

This probably has nothing to do with the problem that you are having.
 
Upvote 0
Good morning. I have added an other criteria into inner if but why it works this way and not that way?
IF(('All JL'!$B:$B="BILL")*('All JL'!$F:$F<>"2100030007"),'All JL'!$I:$J))) ---- work
IF(('All JL'!$B:$B="BILL")*(LEFT('All JL'!$F:$F,2)<>"21"),'All JL'!$I:$J))) ----- not work

Thank you

These IF bits do not test the same thing. The test 'All JL'!$F:$F<>"2100030007" will pick out all of the numeric values in column F including the numeric value 2100030007, while (LEFT('All JL'!$F:$F,2)<>"21") will negate (exclude) anything that starts with 21, numeric or not.
 
Upvote 0
These IF bits do not test the same thing. The test 'All JL'!$F:$F<>"2100030007" will pick out all of the numeric values in column F including the numeric value 2100030007, while (LEFT('All JL'!$F:$F,2)<>"21") will negate (exclude) anything that starts with 21, numeric or not.
Good afternoon. I have try not to use full column and it works now but may i check this issue please? when it work and when it doesn't? <>{"2100030007","2100040005"}. I tried normal sumif with this trick and it works, why it does not work in my case?
IF(ISNA(MATCH('All JL'!$E$2:$E$100,IF('All JL'!$G$2:$G$100={"VAT-Output","WHT Payable"},'All JL'!$E$2:$E$100),0))
Thank you very much
 
Upvote 0
Good afternoon. I have try not to use full column and it works now but may i check this issue please? when it work and when it doesn't? <>{"2100030007","2100040005"}. I tried normal sumif with this trick and it works, why it does not work in my case?
IF(ISNA(MATCH('All JL'!$E$2:$E$100,IF('All JL'!$G$2:$G$100={"VAT-Output","WHT Payable"},'All JL'!$E$2:$E$100),0))
Thank you very much

We need:

IF(ISNA(MATCH('All JL'!$E$2:$E$100,IF(ISNUMBER(MATCH('All JL'!$G$2:$G$100,{"VAT-Output","WHT Payable"},0)),'All JL'!$E$2:$E$100),0))
 
Upvote 0
Hello. May I know when should I use the brackets and when not?

Thank you
[1]
{"VAT-Output","WHT Payable"}

is equivalent of

[2]
X2:Y2

where X2 = VAT-Output and Y2 = WHT Payable.

We could have used a range like X2:Y2, but when the range is small as here, [1], the hard-coded array form, is also chosen, as we have done.
 
Upvote 0

Forum statistics

Threads
1,217,394
Messages
6,136,349
Members
450,005
Latest member
BigPaws

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