Selecting the different Range of cells based on values

[Closed]
Report
Posts
1
Registration date
Thursday August 11, 2016
Status
Member
Last seen
August 11, 2016
-
 Blocked Profile -
Hi all,
consider the Excel sheet
A B C D
1 NAME CITY AGE CLASS
2 ALEX NEWYORK 20 D
3 JOHN DURBAN 20 A
4 PRINCE DELHI 20 V
5 AMY TOKYO 20 C
6 LUCY MOSCOW 20 W
7 CARA LONDON 20 E

here I need the VBA logic based on the following scenario

IF city = Newyork, i have to copy and paste
DURBAN 20 A
DELHI 20 V

IF city = Tokyo, i have to copy and paste
MOSCOW 20 W
LONDON 20 E

please give me VBA logic how to copy that cells dynamically based on values in cell and paste in another excel sheet

Thanks in Advance
@akilsyed

1 reply


The if statement is as follows:

=IF(logictest,true,false)

You can nest IF as in:

=if(a2="newyork",B2 & "-" & b3 & "-" & b4,if(a2="tokyo",c2 & "-"c3 & "-" & c4,"NEITHER ONE!")

Try some of your own!

It's kind of fun to do the impossible! -Walter Elias Disney