Help vba to implement formula in a column

Revathi

New Member
Joined
May 26, 2015
Messages
34
Hi all,

Please assist on the below.

I need to implement the following formulas in the entire column AL (Used range) and the formula is

=IF(AND((AK2>=5),(AK2<=10)),"Between 5 & 10 Days",IF(AND((AK2>=10),(AK2<=15)),"Between 11 & 15 Days",IF((AK2)<5,"Less than 5 Days",IF((AK2)>15,"More than 15 Days"))))

Is it possible.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Firstly you can simplify your formula like
=IF(AK3<5,"Less than 5 days",IF(AK3<=10,"Between 5 & 10 Days",IF(AK3<=15,"Between 11 & 15 Days","More than 15 Days")))
To use it on the entire column, just drag the formula down
 
Upvote 0
This is my code.. but i dont know how to implement this in a single shot.. Please help

Sub sample21()
Worksheets("Raw datum").Activate
Dim score As Integer, result As String
score = Range("AK2").Value
If score >= 5 Then result = "Between 5 & 10 Days"
If score <= 10 Then result = "Between 05 & 10 Days"
If score >= 10 Then result = "Between 11 & 15 Days"
If score <= 15 Then result = "Between 11 & 15 Days"
If score < 5 Then result = "Less than 5 Days"
If score > 15 Then result = "More than 15 Days"
Range("AL2", "AL" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
Range("AL2").Value = result
End Sub
 
Upvote 0
If you just want the value returned try
Code:
Sub NumberofDays()
   With Range("AL2", Range("AK" & Rows.Count).End(xlUp).Offset(, 1))
      .Value = Evaluate(Replace("IF(@<5,""Less than 5 days"",IF(@<=10,""Between 5 & 10 Days"",IF(@<=15,""Between 11 & 15 Days"",""More than 15 Days"")))", "@", .Offset(, -1).Address))
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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