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:

2011
2011
2011
2011
2012
2012
2012
2012
2013
2013
2013
2013
2014
2014
2014
2014

Co.1

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.1

<tbody>
</tbody>

Co.2

<tbody>
</tbody>

Co.2

<tbody>
</tbody>
Acct Name
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
DIESEL
PROPANE
Year of last propane Purchase
Lost?
Year Lost
GR
-
-
-
-
-
-
-
-
-
3
-
-
-
-
-
-
2013
MO
-
-
29
-
-
-
128
-
55
30
-
-
-
-
15
-
2013
CH
-
-
-
-
-
-
-
-
-
-
-
-
-
3
-
-
2014
TI
-
-
16
-
-
5
7
-
-
-
11
-
11
-
-
-
2012

<tbody>
</tbody>



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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,216,217
Messages
6,129,567
Members
449,517
Latest member
Lsmich

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