# Formula: Simple but complex for me

#### BillV

##### New Member
Can someone help me build a formula that will do this:

Always subtract the smaller number from the larger number
IF B26 is greater than B30 then subtract B30 from B26
IF B30 is greater than B26 then subtract B26 from B30
If the result is less than 59 OK
If the result is greater than 300 OK

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### dialup

##### Board Regular
try

=IF(B26-B30 > 0,B26-B30 ,B30-B26)

sorry only read the 1st bit - i'll look at the second criteria

Last edited:

#### BillV

##### New Member
Can you give me the whole enchilada?

#### jerel1429

##### New Member
You might need two cells to do this. Try this:

In cell B32: =IF(B26>B30,B26-B30,B30-B26)

#### Scott Huish

##### MrExcel MVP
You should be able to do it in one cell:

#### dialup

##### Board Regular
this works put it in any cell

=IF(IF(B26-B30 > 0,B26-B30,B30-B26) <59,IF(B26-B30 > 0,B26-B30,B30-B26),IF(IF(B26-B30 > 0,B26-B30,B30-B26) >300,IF(B26-B30 > 0,B26-B30,B30-B26),"ALERT"))

#### BillV

##### New Member
Each of these formula's seem to be close. I probably didn't provide the best explanation. Hotpepper's formula is more of what I expected. I need to do more testing. I'll come back if I need additional help. Thanks to everyone!

Replies
1
Views
323
Replies
7
Views
220
Replies
2
Views
115
Replies
6
Views
102
Replies
3
Views
282

1,191,197
Messages
5,985,231
Members
439,951
Latest member
flamingogaslight

### 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.

### Which adblocker are you using?

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

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