Multiple condition if statement

T

Tel

Hi Guys,

I'm back!

I have an problem in that I want to calculate the following:

If Summary!D3 = 3 then NewSheet! A5 = Summary! R3
But
If Summary!D3 = 2 then NewSheet!A5 = Summary! S3
or
If Summary !D3 = 1 then NewSheet!A5 = Summary T3
else ""

In essence I want a formula or Macro that will display a result in a new
sheet which is dependent upon the value of cell D3.

This needs to be repeatable as I will have 18 times I will need to calculate
this (i.e D3, E3, F3 etc)

Thanks

Terry
 
T

Tel

I've found the answer:

For the benefit of others here it is:

=IF($D$3=AG2,AG3,(IF($D$3=AH2,AH3,(IF($D$3=AI2,AI3,(IF($D$3=AJ2,"")))))))

Now all I need is help to write a macro that will copy all the text in Cells
AD1:AD34 and paste it as values into column C of a new workbook then remove
the blank lines in the new workbook and saving it with a specific filename
sourced from 2 cells in the current workbook.
 
D

David Biddulph

Just a minor point, but you can lose half a dozen of those parentheses.

=IF($D$3=AG2,AG3,(IF($D$3=AH2,AH3,(IF($D$3=AI2,AI3,(IF($D$3=AJ2,"")))))))
can become
=IF($D$3=AG2,AG3,IF($D$3=AH2,AH3,IF($D$3=AI2,AI3,IF($D$3=AJ2,""))))
 
F

Fred Smith

What happens if d3 doesn't equal any of the cells listed? With your formula,
you will get FALSE returned. Perhaps you want (extraneous parentheses also
removed):
=IF($D$3=AG2,AG3,IF($D$3=AH2,AH3,IF($D$3=AI2,AI3,IF($D$3=AJ2,AJ3,""))))

Regards, Fred
 
T

Tel

Hi Fred,

Many thanks for your response. to be honest I was pretty damn pleased with
myself that I'd worked it out this far.

To be honest the user has no control over the content of D3 so it shouldn't
be an issue. However, in the interests of completeness I take your comment
on board, could you advise which set of parentheses are extraneous please.

Many thanks

Tel
 
F

Fred Smith

It's in my response. The formula I posted has the extraneous parentheses
removed.

Regards,
Fred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top