# If Then Else Statement .... Help

#### KillerDragonKC

##### New Member
I believe what I am looking for is a proper If Then Else statement to put into my current VBA code.

What I have is Numerical values in Column H, of which the only 2 I am concerned with is 220 or 221.

*If the value in the cell of Column H is 220 then the formula =IF(AND(L2>(365-(Import!\$E\$3-TODAY())), L2<365),"YES","NO"), would need to be the result.
-----Basically what I have is the end of the current month in cell E3 of the Import Tab. The formula tells me if the current line is going to cross the 365 day threshold by the end of this month. If it is then the result would be YES

*If the value in the cell of Column H is 221 then the formula =IF(AND(L2>(90-(Import!\$E\$3-TODAY())), L2<90),"YES","NO"), would need to be the result.
Same scenario as the 220 only in this case I am determining if the line will cross the 90 day threshold by the end of this month.

*All other values in Column H would need to be answered with a NO.

I have, with the help of this forum, been able to get the script setup to import my text file and get me to this point. I am just stumped at this crossroad.

I have researched and come up with nothing that I can modify to work in my favor. I hope one of the many guru's on this forum can direct me to a solution.

Thank you ahead of time for any assistance you can provide.

### Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

#### ukmikeb

##### Well-known Member
Hi

Try :-
Code:
``=IFERROR(IF(AND(L2 > (INDEX({365,90},MATCH(H2,{220,221},0))-(Import!\$E\$3-TODAY())), L2 < INDEX({365,90},match(h2,{220,221},0))),"yes","no"),"no")``

assuming H2 is the starting cell.

hth

#### KillerDragonKC

##### New Member
That is perfect. Works like a charm. Now I can move on to the other tasks I need to get this sheet to do. I really appreciate your help.

Replies
5
Views
215
Replies
1
Views
99
Replies
5
Views
558
Replies
6
Views
295
Replies
10
Views
210

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,480
Messages
5,770,341
Members
425,612
Latest member
martinijr

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