ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formula for finding an element (https://www.excelbanter.com/excel-discussion-misc-queries/249089-formula-finding-element.html)

bim-bom

Formula for finding an element
 
Hi,

I have a spreadsheet:

1 2 100
5 6 200
5 11 300

I want to find a row which where first column has a specific value and
the second column has a specific value, and print a value in the third
column.

So, I want something like:

= FIND_VALUE (A1:A3 ; 5 ; B1:B3 ; 6 ; C1) // finds 5 in the first column
and 6 in the second
And it should show the value 200

T. Valko

Formula for finding an element
 
One way...

Array entered** :

=INDEX(C1:C3,MATCH(1,IF(A1:A3=5,IF(B1:B3=6,1)),0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"bim-bom" wrote in message
...
Hi,

I have a spreadsheet:

1 2 100
5 6 200
5 11 300

I want to find a row which where first column has a specific value and
the second column has a specific value, and print a value in the third
column.

So, I want something like:

= FIND_VALUE (A1:A3 ; 5 ; B1:B3 ; 6 ; C1) // finds 5 in the first column
and 6 in the second
And it should show the value 200




bim-bom

Formula for finding an element
 
T. Valko pisze:
One way...

Array entered** :

=INDEX(C1:C3,MATCH(1,IF(A1:A3=5,IF(B1:B3=6,1)),0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.


Thank you very much - it works perfectly. Now I know how to know make
things like that.

JLatham

Formula for finding an element
 
If you know that the pairs in columns A and B will always be unique, then you
can use SUMPRODUCT() in pre-2007 Excel, or SUMIFS() in Excel 2007. By
unique, I mean there would not be another row with 5 in a AND 6 in B.

Excel 2003 formula:
=SUMPRODUCT(--(A$1:A$3=5),--(B$1:B$3=6),C$1:C$3)
you can substitute a cell address for 5 and 6.

Excel 2007 formula:
=SUMIFS(C$1:C$3,A$1:A$3,"=" & 5,B$1:B$3,"=" & 6)
again, you can substitute cell addresses for the 5 and 6


"bim-bom" wrote:

Hi,

I have a spreadsheet:

1 2 100
5 6 200
5 11 300

I want to find a row which where first column has a specific value and
the second column has a specific value, and print a value in the third
column.

So, I want something like:

= FIND_VALUE (A1:A3 ; 5 ; B1:B3 ; 6 ; C1) // finds 5 in the first column
and 6 in the second
And it should show the value 200
.


T. Valko

Formula for finding an element
 
You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"bim-bom" wrote in message
...
T. Valko pisze:
One way...

Array entered** :

=INDEX(C1:C3,MATCH(1,IF(A1:A3=5,IF(B1:B3=6,1)),0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the
SHIFT key then hit ENTER.


Thank you very much - it works perfectly. Now I know how to know make
things like that.





All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com