Ask Experts Questions for FREE Help !
Ask
    jimisugly's Avatar
    jimisugly Posts: 1, Reputation: 1
    New Member
     
    #1

    May 8, 2009, 08:41 AM
    if equal to and above formula
    Hi,

    I'm trying to get a cell to multiply a given value from another cell to show the answer.

    Basically I'm trying to get it to show

    If M5=1 then M6=3068
    If M5=2 then M6=3068+3068/2 OR (3068+1534)
    If M5=3 then M6=3068+3068
    If M5=4 or above then M6=3068+3068+3068/2 OR (3068+3068+1534)

    Can anyone tell me the formula I need as my head is spinning round from staring at this for 3 days!!
    Zazonker's Avatar
    Zazonker Posts: 126, Reputation: 19
    -
     
    #2

    May 8, 2009, 09:42 AM

    Well, there's more than one way to do this, but assuming that you have good reason for the layout of the sheet of which this is a part, the following will do what you want. I put the '/2' version, just to make it track with your definition and to help for an alternative discussed at the end of this message. This is the equation to put in M6:

    =IF(M5=1,3068, IF(M5=2, 3068+3068/2, IF(M5=3, 3068+3068, 3068+3068+3068/2)))

    The implicit assumption here is that M5 will always be an integer and will not be negative. If these aren't true, a couple more nested if's could be added.

    A couple of comments:
    Personal preference (probably from programming training/experience), I don't like putting values into equations anymore than I have to - it makes you look at the equation to see what you did. I'd pick an area on the spreadsheet for my constants and label them, and then use the cell reference instead of the number in the equation. Sometimes, it's even better to name the cells and use the name in the formula.

    In this case, say 3068 is something called "truck", you label a cell in your constant definition area "truck", store 3068 in it, and then put "truck" (without the quote marks) everyplace in the formula where 3068 appears.

    Hope this helps.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #3

    May 8, 2009, 10:24 AM
    Quote Originally Posted by jimisugly View Post
    If M5=1 then M6=3068
    If M5=2 then M6=3068+3068/2 OR (3068+1534)
    If M5=3 then M6=3068+3068
    If M5=4 or above then M6=3068+3068+3068/2 OR (3068+3068+1534)
    To avoid having to calculate IFs over and over, and since these value appear to be constants, my take would be:

    =LOOKUP(M5,{0,1,2,3,4},{0,3068,4602,6136,7670})

    The LOOKUP() function uses "fuzzy math" so any numbers missing during the lookup will round DOWN to the next nearest number. So, anything above 4 will keep using 4.

    Any values less than 0 would give an error. I imagine you could solve that by changing the first 0 to something less than zero, like -10000. But that may not be necessary based on how your cell M5 is getting its value.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

When does 1 plus 1 plus 1 equal 1 [ 4 Answers ]

When does 1 plus 1 plus 1 equal 1

IRQ not less than or equal [ 1 Answers ]

Hello, I need help! I finally realized I had a bad mem board and removed it. Now I only have 512MB left. The BIOS finds both HDDs, CD and DVD. Now when I try to boot XP from disc, the XP start screen comes up for 5 sec, then get BLUE screen with IRQ NOT LESS THAN OR EQUAL error and it...

She has his last name does this mean equal guardianship [ 5 Answers ]

I recently left the father of my 15month old daughter he wants equal custody I want full she has his last name but we weren't married, I've been her primary caregiver/stay at home mom since she was born does he have equal guardianship and as much chance of custody as myself?

Dad wants equal time [ 4 Answers ]

My friend had a brief relationship with this woman at work(3mos) which possibly resulted in her getting pregnant. She also has twin boys by this other guy we work with(we all work in the same wherehouse). She also has a 9 year old daughter with this other guy. But anyway, she has anger issues. ...


View more questions Search