Complex lookup problem

mikah323

New Member
Joined
Dec 22, 2010
Messages
4
:confused:

Hello everyone - I have a complex lookup formula problem that I hope someone can help me with.

I’m working with a complex excel workbook that I’m trying to build out to include more visibility, and I’m stuck with “writer’s block” on an issue because I’m not an advanced user of combo formulae in Excel (which I think would solve the problem).

Here’s what I’m trying to do:
I want to insert a column that will indicate a value that is looked up in another cell using a formula that I can insert into multiple rows.
Here’s the problem:
At the top of the workbook, in the first 3 rows are fixed data elements/titles that follow the following pattern:
Row 1: space
Row 2: space
Row 3: date in the format of Month/Year (this is currently only listed above DE 2 below, but I can adjust to include an invisible/white date above each DE for simplicity)
Row 4:
Column 1: Data element 1 (DE1)
Column 2: DE 2
Column 3: DE 3
Column 4: DE 4

The pattern described above is repeated across 24 months

Now, the above pattern starts about 10 columns into the workbook as the first 9 columns contain a list of items we are tracking. One of these columns contains a value for the item that is plotted in one of the 24 months (in the columns to the right) in the SAME row. Here is an example of the pattern:
Column 1: Task #
Column 2-4: other identifying task information
Column 5: Description of task
Column 6: Amount
Column 7: The column I want to insert: date that the amount is plotted in to the right

For corresponding row items under column 7 (which I can move before column 6 if need be) that have a value, I want to look up values in column 6 in THAT row all the way to the right and when the value is found, it should display the date in the fixed row# 3 (and with a simple modification, will be in the same column that the value is found in).

I’m thinking because the date row (row 3) is fixed, and for each given item I’m doing a look up on, the row is known, there has to be a way to do a combo lookup formula that will find the value and display the date.

There are a couple other variables here that have prevented me from using a simple search for value or v/hlookup:
-If a given amount is not present under one of the dates, there are $0 (which need to remain there)
-The value may show up twice in the same row, sometimes under a different date pattern, and I need the date shown to be the FIRST time the value shows up for
-Given the above, there are 3 values in a given row after the display column I’m trying to insert: 0s, blanks, and the value that’s being searched for (sometimes listed twice)
-Because values may be the same for other items, I can’t do a simple search in the entire workbook – it has to be specific to the relevant row item
-Values aren’t necessarily always ascending

While I’d love just a solution to the display column above, the optimal solution would be a display/lookup formula that colors the cell green if the value is listed twice (which indicates the item is “finished”) and yellow if it’s listed only once (which indicates it’s “open” or wip).

Any help would be greatly appreciated!!
Thanks,
Mike
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Welcome to the Board Mike,

For the date lookup, if you extend your dates across Row 3, you can use the formula shown in Cell G4 below.

Excel Workbook
FGHIJKLMNO
1
2
3AmountFirst Match DateNov-10Dec-10Jan-11Feb-11Mar-11Apr-11
4134Dec-10(1) Match01340000
5473Jan-11(2) Matches0047304730
624Feb-11(3) Matches000242424
7893#N/A(0) Matches11100000
Match Example
Excel 2007
Cell Formulas
RangeFormula
G4=INDEX(J$3:AG$3,1,MATCH(F4,J4:AG4,0))



mikah323 said:
Row 3: date in the format of Month/Year (this is currently only listed above DE 2 below, but I can adjust to include an invisible/white date above each DE for simplicity)

If you'd rather not see the dates except for the first one in Cell J3, you can modify to use the Index value (which DE column had first match) to calculate the date. (First date + Number of Months)

mikah323 said:
....the optimal solution would be a display/lookup formula that colors the cell green if the value is listed twice (which indicates the item is “finished”) and yellow if it’s listed only once (which indicates it’s “open” or wip).

You can display the colors using Conditional Formatting. In the example shown above, I used two formula-based Rules for the Range (G4:G20)

Make Green if this formula is True: =2*$F4=SUM($J4:$AG4)
Make Yellow if this formula is True: =$F4=SUM($J4:$AG4)

Hope this helps.
 
Upvote 0
Jerry -

Thank you SO much - I really appreciate this.
The date look up worked beautfully (which is the key part).

The conditional formatting I'm having trouble with setting - I keep getting the following error when I try to set the conditional formatting with formulae (I've adjusted your formulae only for the actual cell references in my workbook):

"You cannot use relative references in Conditional Formatting criteria for color scales, data bars, and icon sets"

Any idea what I'm doing wrong or if there is a work around? Obviously you got it working in yours, so maybe I'm not setting this up in the right place...

Once again - thank you very much for sharing your expertise!

Mike
 
Upvote 0
Mike,

Glad to hear that the date lookup worked for you.

The conditional formatting I'm having trouble with setting - I keep getting the following error when I try to set the conditional formatting with formulae (I've adjusted your formulae only for the actual cell references in my workbook):

"You cannot use relative references in Conditional Formatting criteria for color scales, data bars, and icon sets"

When you are in the Conditional Rules Manager
(In the ribbon: Home > Conditional Formatting > Manage Rules...)

click New Rule and you'll see a list of Rule Types

For the example I gave, you would need to use two separate Rules, each using the Rule Type:
"Use a formula to determine which cells to format"

You might have picked one of other types that use a scale of colors or icons.
 
Upvote 0
Jerry -

Worked like a charm! Thanks so much!

One more question - and it's more curiosity than necessity - is there a way to have the date returned be the date under which the second instance of the amount appeared? In most cases, the 2 amounts appear under the same date, but in some cases one of the amounts occurs in a different month - in those cases, can the formula be tweaked to return the second date?

Thanks again,
Mike
 
Upvote 0
Mike,

You can use this formula to return the second match in the row.

=INDEX(J$3:AG$3,1,MATCH(F4,INDEX(INDEX(J4:AG4,MATCH(F4,J4:AG4,0)+1):AG4,0),0)+MATCH(F4,J4:AG4,0))

If you have just one match it will return N/A since no second match was found.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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