Setting Up Threshold Limit Excel Formula

andersen_yunan

New Member
Joined
Feb 7, 2018
Messages
36
Hi All, currently I have problem to solve this issue regarding setting up formula for case below.
As you can see, I have a payment threshold of $1500, while the original data that I have is only the column #number & #payment made. I want to have a formula that can generate the value in column #payment limit & #payment excess, which the total of payment limit should not exceed given payment threshold for each number.

Is there any excel formula that can solve this?

Thanks in advance!

[TABLE="width: 377"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD="colspan: 2"]Payment Threshold: 1500[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Number[/TD]
[TD]Payment Made[/TD]
[TD]Payment Limit[/TD]
[TD]Payment Excess[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]2000[/TD]
[TD="align: right"]500[/TD]
[TD="align: right"]1500[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2000[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]500[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]1500[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]2200[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]700[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]400[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]1200[/TD]
[TD="align: right"]1100[/TD]
[TD="align: right"]100[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Sorry, the table should look like this.

[TABLE="width: 377"]
<tbody>[TR]
[TD]Number[/TD]
[TD]Payment Made[/TD]
[TD]Payment Limit[/TD]
[TD]Payment Excess[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]2000[/TD]
[TD="align: right"]500[/TD]
[TD="align: right"]1500[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1500[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]2000[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]500[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]3000[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]1500[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]2200[/TD]
[TD="align: right"]1500[/TD]
[TD="align: right"]700[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]400[/TD]
[TD="align: right"]400[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]1200[/TD]
[TD="align: right"]1100[/TD]
[TD="align: right"]100[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Hi Fazza,

I tried to run your formula in my sheet, however it takes so much time >40 minutes since I have around 200k rows.

Is there any way I can make this faster? I was thinking of VBA but it doesn't help with copy and paste value only resulted in copy of value results in first cell only instead of all.
Thanks in advance!
 
Upvote 0
yes, more than 40 minutes is too long
the proposed formulas are simple & should be adequately quick
likely it is something other than these formulas

does the spreadsheet purely have data values in two columns?

or,
are there any other formulas in the spreadsheet?
or conditional format?
or VBA?
or other obvious slow points?
 
Upvote 0
so I tested this on my work laptop : it is a few years old

200,000 records was too much for it to calculate!

so i tried just putting the first formula halfway down - 100,000 cells.
100,000 records in column C only took about 2 to 3 minutes.
then pasted this to values only, took another couple of minutes.

on that basis, it would take another similar ~5 minutes to do the second 100,000 formulas, column C only. pasted to values.
so column C for 200,000 records in 10 minutes
then I'm guessing a lesser duration to do the simple subtraction in column D. I didn't do this step
This suggests whole exercise would take close to 20 minutes.

still seems too slow to me

maybe you'll find it quicker on a newer computer (that is, doing one column at a time, and half the records at a time. Given your computer can do the 200,000 records at all, it is sure to be faster than my oldish work computer)
Or changing the column C formula to a couple of steps using a helper column instead of in the single column. this is likely the best you can do with formulas
 
Upvote 0
so I tested this on my work laptop : it is a few years old

200,000 records was too much for it to calculate!

so i tried just putting the first formula halfway down - 100,000 cells.
100,000 records in column C only took about 2 to 3 minutes.
then pasted this to values only, took another couple of minutes.

on that basis, it would take another similar ~5 minutes to do the second 100,000 formulas, column C only. pasted to values.
so column C for 200,000 records in 10 minutes
then I'm guessing a lesser duration to do the simple subtraction in column D. I didn't do this step
This suggests whole exercise would take close to 20 minutes.

still seems too slow to me

maybe you'll find it quicker on a newer computer (that is, doing one column at a time, and half the records at a time. Given your computer can do the 200,000 records at all, it is sure to be faster than my oldish work computer)
Or changing the column C formula to a couple of steps using a helper column instead of in the single column. this is likely the best you can do with formulas


Hi Fazza, Thanks for the input!
Will try this approach. At first, I though VBA could solve this but it's still stuck in the calculation part as well.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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