Locate data within row that occurs after certain year and fulfills certain criteria.

Byanka

New Member
Joined
Feb 20, 2015
Messages
1
Hello, I'm having trouble with this and I'm hoping somebody here may be able to help.
Here is a sample of my data:

[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]2011
[/TD]
[TD]2011
[/TD]
[TD]2011
[/TD]
[TD]2011
[/TD]
[TD]2012
[/TD]
[TD]2012
[/TD]
[TD]2012
[/TD]
[TD]2012
[/TD]
[TD]2013
[/TD]
[TD]2013
[/TD]
[TD]2013
[/TD]
[TD]2013
[/TD]
[TD]2014
[/TD]
[TD]2014
[/TD]
[TD]2014
[/TD]
[TD]2014
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.1
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]
[TABLE="width: 37"]
<tbody>[TR]
[TD]Co.2
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Acct Name
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]DIESEL
[/TD]
[TD]PROPANE
[/TD]
[TD]Year of last propane Purchase
[/TD]
[TD]Lost?
[/TD]
[TD]Year Lost
[/TD]
[/TR]
[TR]
[TD]GR
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]3
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]2013
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MO
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]29
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]128
[/TD]
[TD]-
[/TD]
[TD]55
[/TD]
[TD]30
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]15
[/TD]
[TD]-
[/TD]
[TD]2013
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]CH
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]3
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]2014
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TI
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]16
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]5
[/TD]
[TD]7
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]11
[/TD]
[TD]-
[/TD]
[TD]11
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]-
[/TD]
[TD]2012
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]



I want a formula that will be able to check the year of last propane purchase and then search to see if there was a diesel purchase any year after that and return the year in one column and the company name in another.

My first attempt was this: =IF(LOOKUP(2,1/(B5:Q5),$B$3:$Q$3)="PROPANE","",LOOKUP(2,1/(B5:Q5),$B$1:$Q$1))

It searched the last purchase made by the customer and returns blank if propane and returns the year if it is diesel. The problem with this is that this does not actually show the year of the Loss (or switch) such as the case with the TI account. Their last purchase was in 2012 and the formula returns 2014 for the last diesel purchase, however they actually switched back to diesel in 2013 when they bought those 11 units from Co.2.

I have one column with a formula that shows the "Year of last propane purchase". I was thinking this may be able to help in creating some type of formula to search any year after that, but I can't figure it out.

Any help is greatly appreciated! And if I can clarify or explain anything further please let me know.
- Byanka
NOTE: The "-" in the data are zero values.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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