IF AND Statement

dannytt93x

New Member
Joined
Sep 13, 2019
Messages
3
Hello,

I am trying to create a tool which dependent on year, will tell me whether to upgrade a phone or repair.

I have go to it work with the year so that it either returns "repair and Replace" dependent on year... but i want to incorporate an and statement in this.

the statement below is what i currently have :

=IF(SUM(COUNTIF(D12,{"2017","2018","2019"}))*(C12=A2),D2,E2)

D2 = Repair E2 = Upgrade

D12 is a year in a drop down menu.

I am trying to do it so i can select phone from drop down... : iPhone 8 , iPhone XR, iPhone X, iPhone 11, iPhone 11 pro. with the repair option shown if iPhone 8 year is less than 2020 but replace if the year is more than that.

iPhone 8 - Repair if year is 2019 or less - upgrade if 2020 or above
iPhone XR - Repair if year is 2020 or less - upgrade if 2021 or above
iPhone X - Repair if 2019 or less - upgrade if 2020 or above
iPhone 11 - Repair if 2021 or less - upgrade if 2022 or above
iPhone 11 pro - Repair if 2020 or less - upgrade if 2021 or above

the question is, can this be all out in one statement so that when i select specific options in excel, it tells someone whether to repair or upgrade.

Both formula and VBA or options.

Any help would be greatly appreciated.

Kind Regards
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You don't say what C12 and A2 are so I'll ignore them.

I would use a table with the phone model and the year after which you Upgrade. That table could be on another worksheet and if you used an Excel Table it would look prettier, but I'll stick with cell references.

DEFGHIJKLM
1Action 1Action 2PhoneTrigger Year
2RepairUpgradeiPhone 8 2019
3iPhone XR 2020
4iPhone X 2019
5iPhone 11 2021
6iPhone 11 pro 2020
7
11YearPhoneAction
122018iPhone 8 Repair

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
dannytt93x

Worksheet Formulas
CellFormula
F12=IF($D$12<=INDEX($M$2:$M$10,MATCH($E$12,$L$2:$L$10,0)),$D$2,$E$2)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Sorry, C12 is the cell where to drop down list is using data validation A2 is referencing the list where the device.

The formula works great... but is there any way to have it so they can pick from consecutive years rather than trigger years? so they would pick the year they are currently in, pick the device, and then it would give them an action of either repair or upgrade?

Kind Regards
 
Upvote 0
I'm sorry but I don't understand "C12 is the cell where to drop down list is using data validation A2 is referencing the list where the device".

In my sheet cell D12 is a Data Validation list of consecutive years, 2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024

Cell E12 is a Data Validation list with source of L2:L10.

...so it currently lets them pick a year, pick the device and gives them the action.
 
Upvote 0
apologies, i had copied the wrong cells wrong on my sheet and had referenced the trigger year rather than a list of years.

Thank you so much for this, absolute legend!
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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