Vlookup --> find next

Sunvisor

Board Regular
Joined
Oct 9, 2009
Messages
233
Lets say you are using a vlookup to a value but there are multiple values with different results...

Is there a formula to do a vlookup and then in the row underneath say if vlookup = the above result, go to next?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Lets say you are using a vlookup to a value but there are multiple values with different results...

Is there a formula to do a vlookup and then in the row underneath say if vlookup = the above result, go to next?
See if this is what you had in mind.

Book1
ABCDEF
1ItemValueLookupCountValue
2A23X334
3X3489
4C2482
5B64
6X89
7X82
8A73
9D97
10C97
Sheet1

You want to lookup all instances of X and return the corresponding values.

In the formulas I use the following defined named ranges:
  • Item
  • Refers to: =Sheet1!$A$2:$A$10
  • Value
  • Refers to: =Sheet1!$B:$B
Enter this formula in E2. This will return the count of records for the lookup value.

=COUNTIF(Item,D2)

Enter this array formula** in F2. This will extract the corresponding data for the lookup value.

=IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

Copy down until you get blanks.

** 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.
 
Upvote 0
No Dear,
I want to compare each cell with and return if matching value found.
See I have attached file in another forum as here attachment is not allowed.

http://www.excelforum.com/excel-gen...value-using-vlookup-function.html#post2527039




See if this is what you had in mind.

Book1
*ABCDEF
1ItemValue*LookupCountValue
2A23*X334
3X34***89
4C24***82
5B64****
6X89****
7X82****
8A73****
9D97****
10C97****
Sheet1

You want to lookup all instances of X and return the corresponding values.

In the formulas I use the following defined named ranges:
  • Item
  • Refers to: =Sheet1!$A$2:$A$10
  • Value
  • Refers to: =Sheet1!$B:$B
Enter this formula in E2. This will return the count of records for the lookup value.

=COUNTIF(Item,D2)

Enter this array formula** in F2. This will extract the corresponding data for the lookup value.

=IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

Copy down until you get blanks.

** 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.
 
Upvote 0
See if this is what you had in mind.

Book1
*ABCDEF
1ItemValue*LookupCountValue
2A23*X334
3X34***89
4C24***82
5B64****
6X89****
7X82****
8A73****
9D97****
10C97****
Sheet1

You want to lookup all instances of X and return the corresponding values.

In the formulas I use the following defined named ranges:
  • Item
  • Refers to: =Sheet1!$A$2:$A$10
  • Value
  • Refers to: =Sheet1!$B:$B
Enter this formula in E2. This will return the count of records for the lookup value.

=COUNTIF(Item,D2)

Enter this array formula** in F2. This will extract the corresponding data for the lookup value.

=IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

Copy down until you get blanks.

** 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.


How would I go about tweaking this formula?

Trying to help a co-worker

Spreadsheet looks something like this:
A B C
Item Component # of Comp
25051 x 2
25051 x 2
25051 x 2




the formula would go in column B where the "x" are

Column A goes on for a long time (1500 rows)
the formula would be similiar to the above post.
The only problem is, I don't know how to 'reset' the formula
when the item number in column A changes.

It works great for the top most part number when you copy it down,
but when it encounters the next part number in Column A, it puts in blanks

Help?
 
Upvote 0
How would I go about tweaking this formula?

Trying to help a co-worker

Spreadsheet looks something like this:
A B C
Item Component # of Comp
25051 x 2
25051 x 2
25051 x 2




the formula would go in column B where the "x" are

Column A goes on for a long time (1500 rows)
the formula would be similiar to the above post.
The only problem is, I don't know how to 'reset' the formula
when the item number in column A changes.

It works great for the top most part number when you copy it down,
but when it encounters the next part number in Column A, it puts in blanks

Help?
Not sure I understand what you're asking.

Maybe all you need to do is change this portion:

...ROWS(...)...

To something like this:

...COUNTIF(A$2:A2,A2)...
 
Upvote 0
Thanks Dear,
I got formula (see below) for the question and worked perfectly.

=IF(ISNA(VLOOKUP($A11,A$2:$C$6,1,FALSE)),"NF",IF(SUMPRODUCT(($A$2:$A$6=$A11)*($B$2:$B$6="Red"))>0,"Y","N"))
 
Upvote 0
I had an additional question about the formulas you posted:
=COUNTIF(Item,D2) and
=IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

I ran them on a similar data set to the one you posted but the problem is, my "Item" column has codes that are of varying lengths and contain numbers and letters (example: H35). The issue is that the formula returns values for all the values in the "Item" column that start with whatever letter the code in D$2 starts with. So I'm getting values from rows that contain H35, H25, HC5, HXF, etc, when I only want H35.

My question is basically, is there a way to tweak the formula so it only returns exact matches, rather than partial matches?

Thanks for any ideas.
 
Upvote 0
I had an additional question about the formulas you posted:
=COUNTIF(Item,D2) and
=IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

I ran them on a similar data set to the one you posted but the problem is, my "Item" column has codes that are of varying lengths and contain numbers and letters (example: H35). The issue is that the formula returns values for all the values in the "Item" column that start with whatever letter the code in D$2 starts with. So I'm getting values from rows that contain H35, H25, HC5, HXF, etc, when I only want H35.

My question is basically, is there a way to tweak the formula so it only returns exact matches, rather than partial matches?

Thanks for any ideas.
Can you post some sample data?
 
Upvote 0

Forum statistics

Threads
1,224,878
Messages
6,181,529
Members
453,053
Latest member
DavidKele

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