how to get Hlookup value only in specified cell

genetist

Board Regular
Joined
Mar 29, 2013
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Hi to all,
I have data in 2 sheets like this,
sheet1
SX1 SX2 SX3 SX4 SX5
AA ZZ AA GG -/-
in sheet2 i have data like this
SX1 SX2 SX3 SX4 SX5
AA AA AA GG TT
i am doing Hlookup to get value in only columns containing ZZ or -/- not in another columns, my aim is even if i drag my formula from 1st column to last column i should get lookup value only in these in the columns containing ZZ or -/-.
my expected results will be
sheet1
SX1 SX2 SX3 SX4 SX5
AA AA AA GG TT
How can i get this value as per my expectations is Hlookup and match function together will work?
i need help really to solve this problem because my data is so big and i can not do it manually searching for ZZ or -/-.
any help would be appreciated
Thanks in advance
Genetist
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Dear Mohan,
Thank you very much for your reply and for some reason if i dragged that formula giving same value across all the columns.
 
Upvote 0
Dear mohan,
Its working but if dragged it its giving same value like before :)
 
Upvote 0
hi something like below if you need something else then pls upload some sample data


Excel 2007
ABCDEFGHIJK
1SX1SX2SX3SX4SX5SX1SX2SX3SX4SX5
2AAZZAAGG-/-AAAAAAGGTT
3ZZAAAA-/-GGAAAAAAGGGG
Sheet1
Cell Formulas
RangeFormula
G2=IF(OR(A2="ZZ",A2="-/-"),HLOOKUP(G$1,Sheet2!$A$1:$E$2,2,0),A2)



Excel 2007
ABCDE
1SX1SX2SX3SX4SX5
2AAAAAAGGTT
Sheet2
 
Upvote 0
hi something like below if you need something else then pls upload some sample data

Excel 2007
ABCDEFGHIJK
1SX1SX2SX3SX4SX5SX1SX2SX3SX4SX5
2AAZZAAGG-/-AAAAAAGGTT
3ZZAAAA-/-GGAAAAAAGGGG

<COLGROUP><COL><COL><COL><COL><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet1

Worksheet Formulas
CellFormula
G2=IF(OR(A2="ZZ",A2="-/-"),HLOOKUP(G$1,Sheet2!$A$1:$E$2,2,0),A2)

<THEAD>
</THEAD><TBODY>
</TBODY>

<TBODY>
</TBODY>



Excel 2007
ABCDE
1SX1SX2SX3SX4SX5
2AAAAAAGGTT

<COLGROUP><COL><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet2

Dear kevataravind,
Thank you very much for your formula and its working. i want to know how to use this formula A2 itself instead of in column G?
anyway thanks lot for your help
 
Upvote 0
i understood what you want to say but when how the formula will know that it cell has old value is ZZ or -/- so thats why you have to use like i have given or another way is

or macro can do this
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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