Lookup Question

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Quick other question how can i lookup the last value in a range that is visible only

i.e i have this formula

=LOOKUP(9.99999999999E+307,'Group Fixtures'!$C$10:$C$24)

Now depending on how many teams i have the range c10:c24 can go to say c10:c20
c21 - c24 get conditionally formatted to white however the value is still there in the background therefore the lookup still looks up the range from c10:c24. What i need is to lookup the last value in visible range even if the other values are conditionally formatted as white (Not blank).

Many Many Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
hi - whats the condition that you are basing your coloring on?


Hi,

I have times populated for fixtures from c10:c4

10:00
10:10
10:20 etc..

If say there are less teams, there will be less games therefore the timings will cut off

I have this formula to conditionally change the cell colour to white

=ROW(A1)>SUMPRODUCT(--($D$10:$D$24<>"")*--($D$10:$D$24>0))

This works ok but i need the lookup range to change based on the visible data

Hope this makes sense
 
Upvote 0
I have come up with this formula

Will this work or is this a bd way to do it

=LOOKUP(9.9999999999E+307,INDIRECT("F7:F"&J5))
 
Upvote 0
I have come up with this formula

Will this work or is this a bd way to do it

=LOOKUP(9.9999999999E+307,INDIRECT("F7:F"&J5))
That'll probably work but I would use 1E100 instead of 9.9999999999E+307.

=LOOKUP(1E100,INDIRECT("F7:F"&J5))

I can't tell what range you need to look at. In your first post you refer to $C$10:$C$24 and in the second post you refer to $D$10:$D$24 and in the last post you refer to F7:F"&J5. :confused:

What's in J5? This formula:

=SUMPRODUCT(--($D$10:$D$24<>"")*--($D$10:$D$24>0))

Better written as:

=SUMPRODUCT(--($D$10:$D$24<>""),--($D$10:$D$24>0))

Maybe this is what you need:

=LOOKUP(1E100,F7:INDEX(F7:F100,J5))

Or, maybe even simply:

=INDEX(F7:F100,J5)
 
Upvote 0
That'll probably work but I would use 1E100 instead of 9.9999999999E+307.

=LOOKUP(1E100,INDIRECT("F7:F"&J5))

I can't tell what range you need to look at. In your first post you refer to $C$10:$C$24 and in the second post you refer to $D$10:$D$24 and in the last post you refer to F7:F"&J5. :confused:

What's in J5? This formula:

=SUMPRODUCT(--($D$10:$D$24<>"")*--($D$10:$D$24>0))

Better written as:

=SUMPRODUCT(--($D$10:$D$24<>""),--($D$10:$D$24>0))

Maybe this is what you need:

=LOOKUP(1E100,F7:INDEX(F7:F100,J5))

Or, maybe even simply:

=INDEX(F7:F100,J5)


Your formula works fab, i have simply used the indirect with lookup. I think its getting too late for me and im getting confused myself

why use 1E100 instead of 9.999999e+307
 
Upvote 0
Your formula works fab, i have simply used the indirect with lookup. I think its getting too late for me and im getting confused myself

why use 1E100 instead of 9.999999e+307
Ok, I guarantee that you'll get the EXACT same result using either:
  • 9.9999999999E+307
  • 1E100
=LOOKUP(9.9999999999E+307,INDIRECT("F7:F"&J5))
=LOOKUP(1E100,INDIRECT("F7:F"&J5))

So, which one looks more compact and easier to remember?

Quick, without counting them, how many 9s are in 9.9999999999E+307 ? ;)

Here's the secret to how that works...

The lookup_value has to be larger than any number in the range.

You know the data. If the the biggest number in the range will never be greater than 100 then the lookup_value simply needs to be greater than 100. Like 101...

=LOOKUP(101,INDIRECT("F7:F"&J5))

Since I don't know what kind of data you're dealing with I suggested using a gigantic number like 1E100 (scientific notation for the number 1 followed by 100 zeros).

There's a 100% chance that 1E100 is greater than any number you're dealing with and it's easier to remember and much shorter than 9.9999999999E+307.
 
Upvote 0
...

why use 1E100 instead of 9.999999e+307

The latter, that is, 9.99999999999999E+307, is a constant standing for a limit in Excel, not a personal whimsey. What follows is a quote from Excel's Help, searchable under 'limits'...

http://office.microsoft.com/client/&app=ZXL&ver=14Calculation specifications and limits

<TABLE class=collapse><TBODY><TR class=trbgeven><TH>Feature</TH><TH>Maximum limit</TH></TR><TR class=trbgodd><TD>Number precision</TD><TD>15 digits</TD></TR><TR class=trbgeven><TD>Smallest allowed negative number</TD><TD>-2.2251E-308</TD></TR><TR class=trbgodd><TD>Smallest allowed positive number</TD><TD>2.2251E-308</TD></TR><TR class=trbgeven><TD>Largest allowed positive number</TD><TD>9.99999999999999E+307</TD></TR><TR class=trbgodd><TD>Largest allowed negative number</TD><TD>-9.99999999999999E+307</TD></TR></TBODY></TABLE>

The above is consultable at all times.

One would hope that MS would give such constants names like BigNum (or MaxNum). This would help to eliminate zillions of variations.

Here some links on the BigNum and how/why it's used in look up functions
that are driven by a form of binary search:

http://www.mrexcel.com/forum/showthread.php?t=102091

http://www.mrexcel.com/forum/showthread.php?t=310278 (post #7)

An additional note

[1]

=LOOKUP(9.99999999999999E+307,A2:F2)

is the same thing as...

[2]

=LOOKUP(MAX(A2:F2)+Delta,A2:F2)

where Delta is a tiny number, say, 1.

Why the first formula then? Because it is faster (no extra function) than the second formula and the second formula won't survive if A2:F2 houses any error value which MAX can't cope with.

Any difficulty remembering 15 9's...

Consult Help for "limits";
Define a name like BigNum as referring to it;
Use a truncated version like 9.99E+307 in analogy to 3.14 which is known as Pi.
 
Upvote 0
Aladin Akyurek said:
Any difficulty remembering 15 9's...

Consult Help for "limits";
Define a name like BigNum as referring to it;
Use a truncated version like 9.99E+307 in analogy to 3.14 which is known as Pi.
Why go to the trouble of an extra unnecessary step of creating a defined name when simply using 1E100 will work just as well?

Can you show us a "real world" example where using 1E100 does not do the same thing as using 9.99999999999999E+307 ?
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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