Selecting the different Range of cells based on values

Closed
AKILSYED Posts 1 Registration date Thursday 11 August 2016 Status Member Last seen 11 August 2016 - 11 Aug 2016 à 07:49
 Blocked Profile - 11 Aug 2016 à 17:12
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 response

Blocked Profile
11 Aug 2016 à 17:12
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