vba help - if condition check two values between

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
983
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need your help to check Outstanding amount Column A,
should be between -250 or +250, and Column B value Sap Balance.
should be between -250 or +250

if condition met , update column C. shown in below Table.

Book10
ABCD
1Outstanding BalanceSAP BalanceRemarkCriteria to Decide Coumn C as follows
2-250150Condition metO/s Balance and SAP Bal Amount should be between + or – 250
3-251200Condition met
4265250Condition not met
5-365-100Condition not met
60300Condition not met
7-250250Condition Met
8100-400Condition not met
9200Condition not met
Sheet1



Thanks for your help in advance


Thanks
mg
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
How about
Excel Formula:
=IF(AND(ABS(A2)<=250,ABS(B2)<=250),"Met","Not Met")
 
Upvote 0
Hi fluff,

Perfect! it worked, I have written below code as per your formula suggested.

how to use select case for below code.

VBA Code:
Sub Check_Amount_Greater_()
   
    Dim i As Long
    For i = 2 To 9
   
    If Abs(Cells(i, 1).Value) <= 250 And Abs(Cells(i, 2).Value) <= 250 Then
       
        Cells(i, 3).Value = "Met"
    Else
   
        Cells(i, 3).Value = "Not Met"
    End If
       
    Next i

End Sub


Thanks
mg
 
Upvote 0
I wouldn't use select case for this, it's of no real benefit.
 
Upvote 0
Hi Fluff,

how to use below condition
  • For all the rows where value in field “Outstanding balance” is between + or -250 and “Balance As Per SAP” is + or – 250 (except zero),
how to exclude 0 here, this one is tricky in my VBA Code.


Thanks
mg
 
Upvote 0
You will have to include a condition for >0
 
Upvote 0
Hi Fluff,

Great !!! it worked ! many many thanks for your help. (y) ?



Thanks
mg
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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