Vlookup and hlookup

junkforhr

Board Regular
Joined
Dec 16, 2009
Messages
115
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have one column of data.

What I'like to return is below. I'm not sure how to combine vlookup and hlookup or if even these are the formulas to use.

Any help is appreciated.

Desired result
Lookup1Virtual-abc
Lookup2Virtual-678
Lookup3Virtual-lpo

Sample data below where row1 etc are, will contain text and or numeric values. The value I wish to return will always start with the word Virtual.

Sample data in Column A

Lookup1
Row1
Row2
Row3
Row4
Row5
Row6
Row7
Row8
Virtual-abc
Lookup2
Row1
Row2
Row3
Row4
Row5
Row6
Row7
Virtual-678
Row7
Lookup3
Row1
Row2
Virtual-lpo
Row4
Row5
Row6
Row7
Row8
Row9
Row10
Row11
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
See if something like this would suit you.
I have assumed that the left column of the results may not always start with "Lookup" but whatever follows a blank row. If it does always start with "Lookup" then you could also use this in C2, copied down

Excel Formula:
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$40)/(LEFT(A$2:A$40,6)="Lookup"),ROWS(C$2:C2))),"")

22 09 21.xlsm
ABCD
1
2Lookup1Lookup1Virtual-abc
3Row1Lookup2Virtual-678
4Row2Lookup3Virtual-lpo
5Row3  
6Row4  
7Row5  
8Row6  
9Row7  
10Row8
11Virtual-abc
12
13Lookup2
14Row1
15Row2
16Row3
17Row4
18Row5
19Row6
20Row7
21Virtual-678
22Row7
23
24
25Lookup3
26Row1
27Row2
28Virtual-lpo
29Row4
30Row5
31Row6
32Row7
33Row8
34Row9
35Row10
36Row11
37
Extract
Cell Formulas
RangeFormula
C2:C9C2=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$40)/((A$2:A$40<>"")*(A$1:A$39="")),ROWS(C$2:C2))),"")
D2:D9D2=IF(C2="","",INDEX(A:A,AGGREGATE(15,6,ROW(A$2:A$40)/(LEFT(A$2:A$40,7)="Virtual"),ROWS(D$2:D2))))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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