uniqe list with zero balance condition

faizee

Board Regular
Joined
Jan 28, 2009
Messages
214
Office Version
  1. 2016
Platform
  1. Windows
Dear all
i have a following data,


S NoDateSupplierDebit / CreditBILL NODescriptionFolioDebitCrediteach bill balance
125-Jun-14Asif TradersCredit33received bill1150000
225-Jun-14Asif TradersDebit33payment againts chq no. 11221240000
305-Jul-14ABC TRADERSCredit55received bill2240000
405-Jul-14ABC TRADERSDebit56payment againts chq no. 1124440000
506-Aug-13Asif BrotherCredit345received bill5650000
06-Aug-13Asif BrotherDebit33payment againts chq no. 11282225000

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



I want the unique list of suppliers (column c), where balance is zero,
means. only need unique list of suppliers where sum of credit-sum of debit of this supplier is zero

the result of this data should be
Asif brother
Asif traders

Please help
thank you
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Faize, I shot you the workbook back with my solution workbook on sheet 2. Let me know if you have any questions.
 
Upvote 0
Dear all
i have a following data,


S No
Date
Supplier
Debit / Credit
BILL NO
Description
Folio
Debit
Credit
each bill balance
1
25-Jun-14
Asif Traders
Credit
33
received bill
11
50000
2
25-Jun-14
Asif Traders
Debit
33
payment againts chq no. 1122
12
40000
3
05-Jul-14
ABC TRADERS
Credit
55
received bill
22
40000
4
05-Jul-14
ABC TRADERS
Debit
56
payment againts chq no. 1124
4
40000
5
06-Aug-13
Asif Brother
Credit
345
received bill
56
50000
06-Aug-13
Asif Brother
Debit
33
payment againts chq no. 1128
22
25000

<TBODY>
</TBODY>



I want the unique list of suppliers (column c), where balance is zero,
means. only need unique list of suppliers where sum of credit-sum of debit of this supplier is zero

the result of this data should be
Asif brother
Asif traders

Please help
thank you

Let A:J house the above exbibit, with J empty.

K:L houses the required processing...

Supplier BalanceUnique supplier list
10000Asif Traders
10000Asif Brother
0
0
25000
25000

<COLGROUP><COL style="WIDTH: 100pt; mso-width-source: userset; mso-width-alt: 4750" width=134><COL style="WIDTH: 124pt; mso-width-source: userset; mso-width-alt: 5859" width=165><TBODY>
</TBODY>

K2, just enter and copy down:
Rich (BB code):
=SUMIFS($I$2:$I$7,$C$2:$C$7,C2,$D$2:$D$7,"credit")-SUMIFS($H$2:$H$7,$C$2:$C$7,C2,$D$2:$D$7,"debit")

L2, control+shift+enter, not just enter:
Rich (BB code):
=IFERROR(INDEX($C$2:$C$7,SMALL(IF(FREQUENCY(IF($C$2:$C$7<>"",IF(1-($K$2:$K$7=0),
  MATCH($C$2:$C$7,$C$2:$C$7,0))),ROW($C$2:$C$7)-ROW($C$2)+1),
  ROW($C$2:$C$7)-ROW($C$2)+1),ROWS(L$1:L1))),"")
 
Upvote 0
Just Enter:

=IF(SUMIF($C$2:$C$7,C2,$H$2:$H$7)-SUMIF($C$2:$C$7,C2,$I$2:$I$7)=0,"",INDEX($C$2:$C$7,SMALL(IF(SUMIF($C$2:$C$7,C2,$H$2:$H$7)-SUMIF($C$2:$C$7,C2,$I$2:$I$7)=0,ROW($C$2:$C$7)-ROW($C$2)+1),ROWS(M2:M2))))

This one works fine for me. The names shown are of suppliers for which balance is remaining.
 
Upvote 0
S No Date Supplier Debit / Credit BILL NO Description Folio Debit Credit each bill balance
1 25-jun-14 Asif Traders Credit 33 received bill 11 50000 50000
2 25-jun-14 Asif Traders Debit 33 payment againts chq no. 1122 12 40000 -40000
3 5-jul-14 ABC TRADERS Credit 55 received bill 22 40000 40000
4 5-jul-14 ABC TRADERS Debit 56 payment againts chq no. 1124 4 40000 -40000
5 6-aug-13 Asif Brother Credit 345 received bill 56 50000 50000
6-aug-13 Asif Brother Debit 33 payment againts chq no. 1128 22 25000 -25000

G2
Code:
=if(H2="",I2,-H2)

and drag down.

after that make a pivot table of this data and use column B (name) as row and column G as value (sum)
 
Upvote 0
hi, faizee

Here is a non-formula (and non-code) solution: a query table. It will readily handle huge amounts of data. It just needs a refresh to update. This can be set to be automatic.

Save your file. ALT-D-D-N to start the wizard, Excel files, OK, browse & select your Excel file, OK. If you get a message about no visible tables OK to that and then via options select 'system tables'. OK. See your worksheet name/s. Select the one with data and follow the wizard to the end selecting the option to edit in MS Query. Via the SQL icon replace the text you see by that below, changing YourWorksheetName to suit your actual worksheet name. OK to enter the SQL (and also OK to any message about not being able to graphically show ...), see the results, via the 'open door' icon return the results to a worksheet.

regards, Fazza

Code:
SELECT DISTINCT Supplier
FROM (
SELECT Supplier, SUM(MyValue) AS [Balance]
FROM (
SELECT Supplier, CDbl(Credit) AS [MyValue]
FROM [YourSheetName$]
WHERE Credit Is Not Null
UNION ALL
SELECT Supplier, -CDbl(Debit) AS [MyValue]
FROM [YourSheetName$]
WHERE Debit Is Not Null)
GROUP BY Supplier
HAVING SUM(MyValue) = 0)

PS, With a similar approach a pivot table solution is available -without adding helper columns to the source data. It can be a fraction simpler even. :)
 
Upvote 0
A slight variation that is a little simpler.

Code:
SELECT Supplier
FROM (
SELECT Supplier, -Debit AS [Value]
FROM [YourSheetName$]
UNION ALL
SELECT Supplier, Credit
FROM [YourSheetName$])
WHERE Value Is Not Null
GROUP BY Supplier
HAVING SUM(Value)=0
 
Upvote 0

Forum statistics

Threads
1,216,562
Messages
6,131,422
Members
449,651
Latest member
Jacobs22

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