[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Range of cells equal to a single value in Excel functions

Posted on 2014-09-01
7
Medium Priority
?
242 Views
Last Modified: 2014-09-29
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
0
Comment
Question by:WeThotUWasAToad
7 Comments
 
LVL 54

Expert Comment

by:Rgonzo1971
ID: 40297734
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
 
LVL 34

Assisted Solution

by:Rob Henson
Rob Henson earned 400 total points
ID: 40298265
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
 
LVL 50

Accepted Solution

by:
barry houdini earned 1600 total points
ID: 40299177
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:WeThotUWasAToad
ID: 40299329
Rob, your statement,

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

really helps.

Thanks
0
 

Author Comment

by:WeThotUWasAToad
ID: 40334950
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
 
LVL 81

Expert Comment

by:byundt
ID: 40335190
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
 

Author Closing Comment

by:WeThotUWasAToad
ID: 40351000
Extremely helpful. Thanks to everyone who contributed.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question