defining cell value based on conditions.VBA of Formula

kshitij_dch

Active Member
Joined
Apr 1, 2012
Messages
362
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
Hello All,

I am working on an excel sheet wherein i have Column AG named 'Final Status' , Column AH which is 'Report' , Column AI which is 'Approved' and Column AJ which is 'Pending'

Column AG is blank , Column AH , AI and AJ have some data (Text and Numbers), I need a macro or if we can set a formula like if condition is met then i need certain text to be written in column AG.(Conditions are many)

For an Example:

1.) in Column AH , IF cell contains Id's Starting with IN12345 then against that ID cell in Column AG will be written as "Disbursed"

[TABLE="class: grid, width: 300, align: left"]
<tbody>[TR]
[TD="align: center"]AG[/TD]
[TD="align: center"]AH[/TD]
[TD="align: center"]AI[/TD]
[TD="align: center"]AJ[/TD]
[/TR]
[TR]
[TD="align: center"]Disbursed[/TD]
[TD="align: center"]IN12345[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Disbursed[/TD]
[TD="align: center"]IN98786[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]







2.)In Column AI , IF cell contains Today's Date (Current date) then against that date all cells in column AG will be written as "Approved Today"

[TABLE="class: grid, width: 300, align: left"]
<tbody>[TR]
[/TR]
[TR]
[TD="align: center"]AG[/TD]
[TD="align: center"]AH[/TD]
[TD="align: center"]AI[/TD]
[TD="align: center"]AJ[/TD]
[/TR]
[TR]
[TD="align: center"]Approved Today[/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: center"]8/25/2017[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Approved Today[/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: center"]8/25/2017[/TD]
[/TR]
</tbody>[/TABLE]







3.)In column AI , Apart from Today's Date , all the other dates , against dates cells in column AG will be "Approved but not Disbursed"

[TABLE="class: grid, width: 300, align: left"]
<tbody>[TR]
[TD="align: center"]AG[/TD]
[TD="align: center"]AH[/TD]
[TD="align: center"]AI[/TD]
[TD="align: center"]AJ[/TD]
[/TR]
[TR]
[TD="align: center"]Approved But not Disbursed[/TD]
[TD="align: center"][/TD]
[TD="align: center"]12/25/2016[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Approved But not Disbursed[/TD]
[TD="align: center"][/TD]
[TD="align: center"]10/25/2015[/TD]
[/TR]
</tbody>[/TABLE]









Like this i have many conditions , If somebody can help me with a vba code it would be great as i have tried by recording filtering it is not happening .
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
i am getting error in this formula ?


=IF(ISERROR(SEARCH("*IN*",AH1,1)),"","Disbursed"),IF(ISERROR(SEARCH("*Today()*",AI1,1)),"","WC Approved Today")
 
Upvote 0
I have done it for current date .


HTML:
Sub FindDate()
For Each cell In ActiveSheet.Range("A1:A10")   
If cell.Value = [Today()] Then    
cell.Select
ActiveCell.Offset(0, 1).Value = "WC Approved"    
End If
Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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