AND/OR help

Waltc_Diamond

New Member
Joined
Jul 13, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Hi: I have a list of vehicles of various mileage and I'm trying to write a formula that compares cells going across columns for future years, with vehicle total miles and returns the year that the vehicle meets or exceeds 150,000. I tried using an if(and(formula, but it gave me an error if the vehicle exceeded 150k before the first year, or didn't meet or exceed by the last year.

Here's a sample of my table.

1638402481996.png


Thanks!! Walt
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to Mr. Excel,

Please use XL2BB to show your sample data so that anyone trying to help you doesn't have to try to recreate the data.
Also, what do you want it to show in the "Retire Year" if the initial miles are >150K
 
Last edited:
Upvote 0
Hi Walt,

Does this do what you want?

WaltcDiamond.xlsx
CDEFGH
4Avg Ann milesEst MilesEst MilesEst MilesEst Miles
520212022202320242025Retire Year
61345811849202155232758183433422022
7949061341271484931716982080792024
8572786343276244111476140405After 2025
91062671502542053302410783348902022
1068785993561132041447901600112025
114369451674653226683770226After 2025
12979961210091647752159662832172023
1303382875526102420106845After 2025
144422457144667438442492410After 2025
15972571195521578642211652800782023
161637171992462090813023733304282021
171815242175672692173176594420932021
Sheet1
Cell Formulas
RangeFormula
E5:G5E5=D5+1
H6:H17H6=IFERROR(INDEX($C$5:$G$5,AGGREGATE(15,6,COLUMN($C6:$G6)-COLUMN($B6)/($C6:$G6>=150000),1)),"After "&G$5)
 
Upvote 0
Is this close?

Book1
ABCDEF
1Initial2022202320242025Year
253000.8184557.81106866.8128065.8157617.82025
386145.33122822.3171553.3199505.3220476.32023
4159795.1208292.1236569.1266963.1288912.1Initial
5154810.6202671.6239732.6269903.6314657.6Initial
6147237.4185971.4214007.4241118.4266887.42022
7159762.9200627.9246269.9285072.9318160.9Initial
822159.2543173.2586958.25116348.3159267.32025
9119841.5154668.5201354.5242775.5276045.52022
10145204.5165276.5213106.5235258.5259275.52022
Sheet2
Cell Formulas
RangeFormula
F2:F10F2=INDEX($A$1:$E$1,MATCH(TRUE,A2:E2>150000,0))
 
Upvote 0
New, but related question, I have a list of vehicles by make and model, and a table of make/model and msrp, and I'm trying to write a vlookup formula that looks at both criteria to get the msrp. For example, in column c is the make (Chev, Ford etc) and column d is the model. In the table, I need the formula to find the make & model and enter the appropriate msrp.

Thanks!!

ABCDE
ASSET#YEARMAKEMODELMILEAGE
12/31/2019CHEV1500
80012/31/2012DODGE3500
8100812/31/2018CHEV2500
86180​
8101212/31/2018CHEV2500
88180​
8101712/31/2018CHEV3500
108032​
8102012/31/2018CHEVTAHOE
86224​
8102112/31/2019CHEV1500
134430​
MAKEMODELMSRP
CHEV1500
35000​
CHEV2500
37500​
CHEV3500
40000​
FORDF150
32000​
FORDF250
35000​
FORDF350
38000​
DODGE1500
35000​
DODGE2500
38000​
 
Upvote 0
Yes, you should probably start a new post so others have the chance to answer, but here's my take.

Firstly, I'm not sure how you can establish an MSRP without your table having a model year, e.g. the Chevrolet 1500 has been around over 20 years, but I'll ignore that and answer your VLOOKUP question.

This is interesting as the normal way in Excel 2016 to find data in a table with multiple criteria would be to use INDEX, MATCH, INDEX or even my old favorite AGGREGATE, but you have an interesting challenge so I'm going to use the old method of adding a helper column.

You challenge is that some data such as Model may be interpreted as numeric or text (e.g. 2500). As long as you force your Asset list and lookup table to be text so TAHOE and 3500 are both treated as text, then it works, but if we use a helper column it forces both criteria to be text.

I've added the Concat column (to the left of MSRP because VLOOKUP can't pickup columns to the left) to concatenate Make and Model. Then the VLOOKUP can just concatenate the Asset Make and Model to perform the lookup.

Let me know if you'd also like to see an INDEX, MATCH, INDEX or AGGREGATE approach.

WaltcDiamond.xlsx
ABCDEFGHIJK
1ASSET#YEARMAKEMODELMILEAGEMSRPMAKEMODELConcatMSRP
212/31/2019CHEV150035000CHEV1500CHEV150035000
380012/31/2012DODGE3500No matchCHEV2500CHEV250037500
48100812/31/2018CHEV25008618037500CHEV3500CHEV350040000
58101212/31/2018CHEV25008818037500FORDF150FORDF15032000
68101712/31/2018CHEV350010803240000FORDF250FORDF25035000
78102012/31/2018CHEVTAHOE86224No matchFORDF350FORDF35038000
88102112/31/2019CHEV150013443035000DODGE1500DODGE150035000
90DODGE2500DODGE250038000
10 
2nd Question
Cell Formulas
RangeFormula
F2:F9F2=IFERROR(VLOOKUP(C2&D2,$J$2:$K$9999,2,0),"No match")
J2:J10J2=H2&I2
 
Upvote 0
Solution
Actually the "Year" column B, denotes the model year. The concatenate column and changing the model column to text worked, but if you have time, I'd appreciate seeing an INDEX, MATCH, INDEX and and AGGREGATE approach. I'm not familiar with any of those.

Thanks so much for the help.
 
Upvote 0
OK, here's the INDEX MATCH INDEX solution.

WaltcDiamond.xlsx
ABCDEFGHIJ
1ASSET#YEARMAKEMODELMILEAGEMSRPMAKEMODELMSRP
212/31/2019CHEV150035000CHEV150035000
380012/31/2012DODGE3500No matchCHEV250037500
48100812/31/2018CHEV25008618037500CHEV350040000
58101212/31/2018CHEV25008818037500FORDF15032000
68101712/31/2018CHEV350010803240000FORDF25035000
78102012/31/2018CHEVTAHOE86224No matchFORDF35038000
88102112/31/2019CHEV150013443035000DODGE150035000
90DODGE250038000
10
2nd INDEXMATCHINDEX
Cell Formulas
RangeFormula
F2:F9F2=IFERROR(INDEX($J$2:$J$999,MATCH(1,INDEX(($H$2:$H$999=C2)*($I$2:$I$999=D2),0,1),0)),"No match")


Here's the AGGREGATE solution

WaltcDiamond.xlsx
ABCDEFGHIJ
1ASSET#YEARMAKEMODELMILEAGEMSRPMAKEMODELMSRP
212/31/2019CHEV150035000CHEV150035000
380012/31/2012DODGE3500No matchCHEV250037500
48100812/31/2018CHEV25008618037500CHEV350040000
58101212/31/2018CHEV25008818037500FORDF15032000
68101712/31/2018CHEV350010803240000FORDF25035000
78102012/31/2018CHEVTAHOE86224No matchFORDF35038000
88102112/31/2019CHEV150013443035000DODGE150035000
90DODGE250038000
10
2nd AGGREGATE
Cell Formulas
RangeFormula
F2:F9F2=IFERROR(INDEX($J$2:$J$999,AGGREGATE(15,6,ROW($H$2:$H$999)-ROW($H$1)/(($H$2:$H$999=C2)*($I$2:$I$999=D2)),1)),"No match")
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,334
Members
448,956
Latest member
Adamsxl

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