Range of cells equal to a single value in Excel functions

Formula in Excel to display the date for the last occurrence of a value in a table

Hello,

This is a follow-up question to the above thread. The formula given (by Flyster) for the solution was:

        =LOOKUP(2,1/(B1:B12=B15),A1:A12)

My question in this thread relates to the denominator of the 2nd term which includes the following:

        B1:B12=B15

How can a range of values be equal to a single value?

A range of cells implies multiple values, right? So I understand when a range is part of a function — such as:

        a) entering the formula =SUM(B1:B12) in cell B15 or

        b) asking if the function of a range is equal to the value in a single cell:  =IF(SUM(B1:B12)=B15,1,0)

But what does it mean to put a range of values equal to a single value?

Thanks
WeThotUWasAToadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

B1:B12=B15

Returns a list of true or false depending on the values in the range and the value in B15
for example

12
15
14
15
 would return
False
True
False
True

Regards
0
Rob HensonFinance AnalystCommented:
When working with array formulas, the function looks at each value in a range as an individual value.

So, the example posted, looks at each cell in the range B1:B12 and compares with B15 to generate the list of True/False values as described above.

Thanks
Rob H
0
barry houdiniCommented:
Hello Steve,

You can see this in action using the "Evaluate Formula" Tool....or you can highlight a particular part of the formula and press F9.

In this case if I have "x" in B15 and also have "x" in B4, B7 and B11 then when I select B1:B12=B15 in the formula bar and press F9 I see this array

{FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;TRUE;FALSE}

When you divide 1 by that array you get this as the lookup range:

{#DIV/0!;#DIV/0!;#DIV/0!;1;#DIV/0!;#DIV/0!;1;#DIV/0!;#DIV/0!;#DIV/0!;1;#DIV/0!}

When you lookup 2 in a range that will never contain a value as high as 2 (as here because all values are 1s or errors) then the "match" is with the last number - in this case the 1 in position 11, so the corresponding value from A1:A12 is returned

regards, barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

WeThotUWasAToadAuthor Commented:
Rob, your statement,

…the function looks at each value in a range as an individual value.

really helps.

Thanks
0
WeThotUWasAToadAuthor Commented:
You can see this in action using the "Evaluate Formula" Tool
Barry,

Apologies for my belated reply but thanks for mentioning this tool. I've heard about it before but never really understood its value.

I've made a couple of summary charts (for my own future reference) in the context of the four threads I started which are associated with this topic:

• Formula in Excel to display the date for the last occurrence of a value in a table
• Range of cells equal to a single value in Excel functions
• Using an equation as a term in Excel functions
• Reciprocal as an argument in Excel functions

Also, for convenience, here is the screenshot showing the initial question:Initial Questionin which the goal is to display the date (in C15) for the latest or most recent entry (in the above table) of a user-defined value (B15).

The best solution in that thread (imo) included the following formula:

        =LOOKUP(2,1/(B1:B12=B15),A1:A12)

My 1st summary chart (moving from top to bottom) combines what is displayed in each of the evaluation steps when the Evaluate Formula tool is applied to the above formula:Results of Evaluate Formula toolMy 2nd summary chart (now moving from left to right) displays what I think is happening by setting B15 equal to the range B1:B12 and placing the result as the denominator in the term: 1/(B1:B12=B15):Subsequent StepsI would appreciate any comments regarding the steps which are displayed.
0
byundtMechanical EngineerCommented:
The sequence of operations is great as far as you took it.

The remaining step requires understanding how LOOKUP works. LOOKUP compares the 2 in the first parameter to the values in the "Divide by 1" column. Not finding any match (or value larger than 2), it decides to focus attention on the very last match for a numeric data value. That means LOOKUP finds its match in row 9, and therefore returns the corresponding value from the "Value" column of your table: 07/11/14.

I purposely used the phrasing "corresponding value" instead of value from the same row. Although they are one and the same in this problem, had you been returning a value from a different worksheet, the "corresponding" value would obviously not be in the same row.

Brad
0
WeThotUWasAToadAuthor Commented:
Extremely helpful. Thanks to everyone who contributed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.