DSUM Database "Subtraction"

isadoko

Active Member
Joined
Jan 10, 2005
Messages
322
Office Version
  1. 365
Platform
  1. Windows
XL: 2003
OS: XP

I have a table several 1000 rows in length, headed thus:

Office No Date Amount Source B385# (1,4,5)
1 01/20/05 76,752.98 1
1 01/20/05 (34,291.57) 4
1 01/20/05 (6,304.15) 5

I have a criteria table that looks thus:

Office No Date Date Source B385# (1,4,5)
1 >=1/1/05 <=1/31/05 1
2 >=1/1/05 <=1/31/05 1
3 >=1/1/05 <=1/31/05 1

I want to use only one header in my criteria table and instead have the last or next record reference the previous one and "subtract" one record to keep track of which record to manipulate. I have tried this formula (and variations therof):

=DSUM('Ledger'!$A:$E,"Source B385# (1,4,5)",'DSUM'!A1:D3)-DSUM('Ledger'!$A:$E,"Source B385# (1,4,5)",'DSUM'!A1:D2)

...and it yielded the wrong answer. I want to forego this:

Office No Date Date Source B385# (1,4,5)
1 >=1/1/05 <=1/31/05 1
Office No Date Date Source B385# (1,4,5)
2 >=1/1/05 <=1/31/05 1
Office No Date Date Source B385# (1,4,5)
3 >=1/1/05 <=1/31/05 1

Would apprieciate some hint at a better, working solution. Thanks much.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Aladin,

Thanks for the response: it was good learning. However, I found it unable to give me the solution I seek. Using the Microsoft How To solution (and changing to DCOUNTA) I quickly counted the number of instances of my B385 codes: 1, 4, 5 by my 78 offices; what I could not do is extract the data by date range. This I need for my data will run from Jan-Dec and I need it by month.

My original criteria was Office No, Date, Date, B385# (1,4,5), and it works fine except as you know I had to repeat it for all 78 offices for a total of 168 rows of criteria per month.

What I really desire is a smaller criteria table. One that takes account of the B385 codes, date range and offices; and drop from one row to the next automatically. I hope I am explaining myself clearly enough as I am not an Excel expert by any measure: a true novice willing to experiment and learn. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,800
Members
449,337
Latest member
BBV123

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