Results 1 to 4 of 4

Thread: Excel question

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Excel question

    Hi folks,

    I don't know if this is an approppriate forum for this type of question but, anyway here it is.

    I have an Excel spreadsheet with a set of numbers in the range A5:A200 and another set of numbers in the range B5:B200. Then there's a formula in the range C5:C200 that squares all the numbers in the first column: A5*A5 in cell C5, A6*A6 in cell C6 and so on.

    Then I have an indexer number in cell A1. It can be 0 or 1. I want to change the formula in column C such that, if A1's contents is 0 then the formulas are A5*A5, A6*A6, etc and if the contents of A1 is 1, then the formulas in column C are B5*B5, B6*B6, etc. Of course, once I have the correct formula in C5 then I want to drag over the rest of the column.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    the formula for C5 would be:

    =If($A$1=0,A5*A5,B5*B5)


    note that any value other than 0 will square column B

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Thanks, I just can't believe it was this easy!

    The thing is I know the IF function and have often used it but for some reason I didn't think of it for this situation and spent plenty of time fooling around to no avail.
    Last edited by krtxmrtz; Nov 25th, 2004 at 12:36 PM.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    lol.. we all have moments like that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width