Excel Help
 

MegaSack DRAW - This year's winner is user - rgwb
We will be in touch

[Closed] Excel Help

9 Posts
4 Users
0 Reactions
45 Views
Posts: 0
Free Member
Topic starter
 

I am trying to write a formula in Excel to copy a cell if the criteria of two other cells are filled in with certain text but am completely stumped.

This is what i'm looking to achieve;

Column D = Column C if Column A is W or X and Column B is Y of Z

Please can you help my sanity!

Thanks


 
Posted : 18/12/2017 10:21 am
Posts: 17303
Free Member
 

in cell d1.....

=if(a1="W",C1,if(a1="X",C1,if(b1="Y",C1,if(b1="Z",C1,0))))

...assumes W,X, Y and Z are text strings and they're evaluated in that order for an exact match.


 
Posted : 18/12/2017 10:26 am
Posts: 8706
Full Member
 

In D1

=IF(AND(OR(A1="W",A1="X"),OR(B1="Y",B1="Z")),C1,"")

If I'm understanding you correctly


 
Posted : 18/12/2017 10:32 am
Posts: 0
Free Member
Topic starter
 

Thank you very much Mr Panther, sanity is saved.


 
Posted : 18/12/2017 10:37 am
Posts: 17303
Free Member
 

You're welcome.

As with most things, and as Rubber_Buccaneer has demonstrated, there's usually more than one way to achieve the same thing.

Some methods are more elegant than others.

I now expect a three page thread explaining why my simplistic , down and dirty method is clearly not the best one.

There may be VBA involved.


 
Posted : 18/12/2017 10:42 am
Posts: 8706
Full Member
 

But Mr Panther has given you

Column D = Column C if Column A is W or X [s]and[/s] [b]or[/b] Column B is Y or Z


 
Posted : 18/12/2017 10:43 am
Posts: 17303
Free Member
 

See?

Let the Excelling commence!

RB is right. I didn't read the question properly.


 
Posted : 18/12/2017 10:44 am
Posts: 8706
Full Member
 

There may be VBA involved.

May I add 'should have been a database'

I didn't read the question properly.

In my experience it's very likely the user hasn't asked for what they actually wanted anyway 🙂


 
Posted : 18/12/2017 10:50 am
Posts: 0
Free Member
Topic starter
 

I will admit I jumped the gun a bit in excel actually giving be a number rather than #VALUE, Rubber Buccaneer's formula is the correct one.

Thank you RB


 
Posted : 18/12/2017 10:52 am
Posts: 25875
Full Member
 

Usually I'd do it in python*. This time though, pirate not panther

* whatever the holy hell python is


 
Posted : 18/12/2017 11:01 am