 • 447K Members
• 8,674 Online
• 539K Conversations
SOLVED

# Version of Lookup formula?

Have a table dates across the top and items down the side.

The body of the table gets populated with "1s" which auto formats to a cell colour.

Id like to create a column that looks up when a row has a "1" in and then returns the date in the column header.

Just struggling to find what sort of formula to use for it any guidance would be appriciated

11 Replies

# Re: Version of Lookup formula?

I suppose you want to return the date IF the cell contains 1; otherwise, you want to return empty text. I hope you now know what formula to use.
Solution

# Re: Version of Lookup formula?

`=LOOKUP(PI(),B2:Z2,B\$1:Z\$1)`

# Re: Version of Lookup formula?

I had tried using "IF" but the "1" could be in any cell across the table, and i didnt want to have to create a long formula with 20 "IF" Logical tests!
Is there a shorter way of achieving the same thing?

@Detlef Lewin
Many thanks!

# Re: Version of Lookup formula?

If there is more than one cell filled in a row, the formula picks up the cell furthest to the right.

This is fine in the main but just wanted to know if there was any way of changing it to pick the first cell it comes to? (furthest to the left?)

# Re: Version of Lookup formula?

That would be:

`=INDEX(B\$1:Z\$1,MATCH(1,B2:Z2,0))`

# Re: Version of Lookup formula?

I’m just curious. What would be the equivalent formula to achieve the same result using LOOKUP and OUR sexy PI() as the lookup_value argument?

# Re: Version of Lookup formula?

Dear @Twifoo,

I have no idea. The problem is that LOOKUP() works from right to left.

# Re: Version of Lookup formula?

Hello @Detlef Lewin,
Just to satisfy my curiosity, this is the equivalent of the INDEX-MATCH formula using LOOKUP-PI.
=LOOKUP(PI(),
2/(1/COLUMN(B2:Z2)=AGGREGATE(14,4,1/COLUMN(B2:Z2)*((B2:Z2)=1),1)),
B1:Z1)
Indubitably, INDEX-MATCH formula is preferred but the foregoing formula satisfied my curiosity!

# Re: Version of Lookup formula?

When dynamic arrays are released, multiple matches will be returned by

= FILTER( Date, Criterion )

To do something similar now would need

= SMALL( IF( Criterion, Date ), {1,2,3} )

The dates could also be listed in a wrapped cell using

= TEXTJOIN( CHAR(10), TRUE, IF( Criterion, TEXT(Date,"dd mmm"), "" ) )

# Re: Version of Lookup formula?

I expected that a possible solution would be considerably longer and more complex.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies