Countif contra formula

kingjet

New Member
Joined
Apr 30, 2024
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi All,



I thought this formula was working as it did find a lot of contra entries, which then shown in column AJ a 1 or 2 – 2 meant it has a matching contra based on the concat in AI, 1 meant it cannot find a matching entry



I was happy until I randomly checked an amount (180) and realised it as 1 when it should have been 2



In column AD it counts how many 180 there are above (its filtered on 180) - its got over 100,000 lines so if you look at cell AI 971, at the end it says 180-4, this is because it looks at column AD and see how many times before 180 has come - so it says its seen 180- 4 times before ( i am trying to net the same figures) problem is row 973 should match 971 but BECAUSE the concat at the end says 180-4 & 180-1 it counts that as two separate lines (non matching) and gives me the incorrect number 1 in column AJ


if you look at column AI cells 971 and 973 they are exactly the same and should net off, but due to concat and countifs it doesn’t match, it thinks its different

I also I think need the countifs formula in Column AI as it if do not the countif in column AJ will show more numbers than 1 or 2 which is incorrect



As an exercise I deleted the 180’s in cells AD 73,136,220 and guess what the cell AJ 971/972 show a 2


btw the concat is the invoice number, client name, and the amount - to make it very unique
 

Attachments

  • hello capture 180.PNG
    hello capture 180.PNG
    66 KB · Views: 26

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Without seeing the file or when looking at the one posted on Excel Forum, i'm see 2 potential issues:
  1. You're mentioning wanting to count anything "above the current cell/row" however your formula is referring the total column. Doing it like this will never come back with a valid answer to "counts how many 180 there are above". To get a valid and correct result from the formula, you need to restrict the counting range.
  2. Your count involves 2 criteria, so my advise change to "countifs" and include both criteria.
Any further help: please use the XL2BB add in to help you post a usefull snippet of your sheet.
 
Upvote 0
Perhaps something like this:
NEw check.xlsx
ABCDEFGHIJ
1Invoice SeparatedCustomer NameSum of RevenueABSCountifConcatCountifExpectedNew
21390951Sahara-29852985129851390951Sahara-122
31390951Sahara29852985129851390951Sahara-122
41393230Sahara-29852985229851393230Sahara-222
51393230Sahara29852985229851393230Sahara-222
61394846Virgin29852985329851394846Virgin-311
712569Plastic-298529853298512569Plastic-31shoul be 22
812569Plastic298529854298512569Plastic-41shoul be 22
91397943Plastic-29852985429851397943Plastic-41should be 22
101390957ALi2077,692077,6912077,691390957ALi-122
111390957ALi-2077,692077,6912077,691390957ALi-122
121390961Univar Speciality Consumables Limited1696,61696,611696,61390961Univar Speciality Consumables Limited-111
131390962Felicia565,64565,641565,641390962Felicia-111
141390963Tele 678,19678,191678,191390963Tele -111
151390963Tele 3049,363049,3613049,361390963Tele -111
161390964Remington884,34884,341884,341390964Remington-111
17123456Plastic Reinforcement Fabrics Limited2985298552985123456Plastic Reinforcement Fabrics Limited-522
18123456Plastic Reinforcement Fabrics Limited-2985298552985123456Plastic Reinforcement Fabrics Limited-522
391397943Plastic29852985629851397943Plastic-61should be 22
Sheet1
Cell Formulas
RangeFormula
D2:D18,D39D2=ABS(C2)
E2:E18,E39E2=COUNTIF($C$2:C2,C2)
F2:F18,F39F2=CONCATENATE(D2,A2,B2,"-",E2)
G2:G18,G39G2=COUNTIF($F$2:$F$33515,F2)
J2:J18,J39J2=COUNTIFS($D$2:$D$39,D2,$A$2:$A$39,A2,$B$2:$B$39,B2)
 
Upvote 0
Perhaps something like this:
NEw check.xlsx
ABCDEFGHIJ
1Invoice SeparatedCustomer NameSum of RevenueABSCountifConcatCountifExpectedNew
21390951Sahara-29852985129851390951Sahara-122
31390951Sahara29852985129851390951Sahara-122
41393230Sahara-29852985229851393230Sahara-222
51393230Sahara29852985229851393230Sahara-222
61394846Virgin29852985329851394846Virgin-311
712569Plastic-298529853298512569Plastic-31shoul be 22
812569Plastic298529854298512569Plastic-41shoul be 22
91397943Plastic-29852985429851397943Plastic-41should be 22
101390957ALi2077,692077,6912077,691390957ALi-122
111390957ALi-2077,692077,6912077,691390957ALi-122
121390961Univar Speciality Consumables Limited1696,61696,611696,61390961Univar Speciality Consumables Limited-111
131390962Felicia565,64565,641565,641390962Felicia-111
141390963Tele 678,19678,191678,191390963Tele -111
151390963Tele 3049,363049,3613049,361390963Tele -111
161390964Remington884,34884,341884,341390964Remington-111
17123456Plastic Reinforcement Fabrics Limited2985298552985123456Plastic Reinforcement Fabrics Limited-522
18123456Plastic Reinforcement Fabrics Limited-2985298552985123456Plastic Reinforcement Fabrics Limited-522
391397943Plastic29852985629851397943Plastic-61should be 22
Sheet1
Cell Formulas
RangeFormula
D2:D18,D39D2=ABS(C2)
E2:E18,E39E2=COUNTIF($C$2:C2,C2)
F2:F18,F39F2=CONCATENATE(D2,A2,B2,"-",E2)
G2:G18,G39G2=COUNTIF($F$2:$F$33515,F2)
J2:J18,J39J2=COUNTIFS($D$2:$D$39,D2,$A$2:$A$39,A2,$B$2:$B$39,B2)
my god i will try this in my file now i think this will work man! let me check on my file
 
Upvote 0
Perhaps something like this:
NEw check.xlsx
ABCDEFGHIJ
1Invoice SeparatedCustomer NameSum of RevenueABSCountifConcatCountifExpectedNew
21390951Sahara-29852985129851390951Sahara-122
31390951Sahara29852985129851390951Sahara-122
41393230Sahara-29852985229851393230Sahara-222
51393230Sahara29852985229851393230Sahara-222
61394846Virgin29852985329851394846Virgin-311
712569Plastic-298529853298512569Plastic-31shoul be 22
812569Plastic298529854298512569Plastic-41shoul be 22
91397943Plastic-29852985429851397943Plastic-41should be 22
101390957ALi2077,692077,6912077,691390957ALi-122
111390957ALi-2077,692077,6912077,691390957ALi-122
121390961Univar Speciality Consumables Limited1696,61696,611696,61390961Univar Speciality Consumables Limited-111
131390962Felicia565,64565,641565,641390962Felicia-111
141390963Tele 678,19678,191678,191390963Tele -111
151390963Tele 3049,363049,3613049,361390963Tele -111
161390964Remington884,34884,341884,341390964Remington-111
17123456Plastic Reinforcement Fabrics Limited2985298552985123456Plastic Reinforcement Fabrics Limited-522
18123456Plastic Reinforcement Fabrics Limited-2985298552985123456Plastic Reinforcement Fabrics Limited-522
391397943Plastic29852985629851397943Plastic-61should be 22
Sheet1
Cell Formulas
RangeFormula
D2:D18,D39D2=ABS(C2)
E2:E18,E39E2=COUNTIF($C$2:C2,C2)
F2:F18,F39F2=CONCATENATE(D2,A2,B2,"-",E2)
G2:G18,G39G2=COUNTIF($F$2:$F$33515,F2)
J2:J18,J39J2=COUNTIFS($D$2:$D$39,D2,$A$2:$A$39,A2,$B$2:$B$39,B2)
hello did not work in the last column j2 - am i supposed to get only 1 and 2 values or like random values?
 
Upvote 0
Hi,

You need to tell me more than “did not work”. The formula I provided was exactly in line with what you mentioned in the column with the “expected” results.
You can download my version of the test sheet in the other forum were you also posted this question.
 
Upvote 0
in my file in the last j2 where yours says 1 and 2 - i am getting numbers 1,2,3,4,15,16,18,21 - when i filter on the 2 i should get a contra but i am also getting two positive numbers that do not net off?
 
Upvote 0
Hi,

You need to tell me more than “did not work”. The formula I provided was exactly in line with what you mentioned in the column with the “expected” results.
You can download my version of the test sheet in the other forum were you also posted this question.
ok one second sorry i will post it correctly wait
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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