Hello,
I've never had any formal training in Excel; everything has been self-taught. I'm working on a complex nested if statement, but I'm told that I have too many arguments. That may well be the case; I just thought I'd see if any experts out there knew of a way to put the following pseudocode into one cell on the second page of an Excel spreadsheet. It would make things a lot easier for me! If there's not a way to simplify this enough to put it in one cell, I can understand - I just wanted to come here to find out for sure.
It looks more complicated than it may need to be. Basically what I'm trying to do is calculate pay for mileage while factoring in the number of participants. In other words, if the mileage was between 0 and 50 miles, and there were 5 or less people, then this cell should be $35.00. But if it's between 0 and 50 and there were more than 5, then this cell should display 175/the number of people (175 being 35 * 5). In other words, more than five people would receive an equal amount of the total pay for five people (this is because five people are the standard, but there are instances in which six or seven could participate and I was hoping to avoid hardcoding that).
The rest of the if statements simply follow that same formula, but for different mileage/pay rates.
Any information would be greatly appreciated.
Thanks,
Beau
---------------
If Sheet1!H2 = “x”
If A2 is between 0 and 50
If the total count of cells in the range of H2:H25 = “x” on Sheet 1 <= 5
Value = 35
Else
Value = (175/sheet 1 total cell count = “x” in the range of H2:H25)
Endif
Else
If A2 is between 51 and 100
If the total count of cells in the range of H2:H25 = “x” on Sheet 1 <= 5
Value = 45
Else
Value = (225/sheet 1 total cell count = “x” in the range of H2:H25)
Endif
Else
If A2 is between 101 and 150
If the total count of cells in the range of H2:H25 = “x” on Sheet 1 <= 5
Value = 60
Else
Value = (300/sheet 1 total cell count = “x” in the range of H2:H25)
Endif
Else
If A2 is between 1 51 and 200
If the total count of cells in the range of H2:H25 = “x” on Sheet 1 <= 5
Value = 45
Else
Value = (225/sheet 1 total cell count = “x” in the range of H2:H25)
Endif
Else
If A2 is >= 201
If the total count of cells in the range of H2:H25 = “x” on Sheet 1 <= 5
Value = (A2 * .20) + 50
Else
Value = (((A2 * .20) + 50) * 5)/sheet 1 total cell count = “x” in the range of H2:H25)
Endif
Endif
Endif
Endif
Endif
Endif
Endif
Bookmarks