IFs and AND help please

Affo01

New Member
Joined
Jul 1, 2016
Messages
18
Hello all.

I'm trying to work out a way to automate some wages. It is for a sports team and I want to include some sort of bonuses for a) winning or drawing and keeping a clean sheet and b) loyalty, the more games you play, the more you earn (base * multiplier).

The screen shot shows the formula I've managed to create and works fine while less than 9 appearances (column P keeps a count). Column O shows 1 for starting and 0.5 for being a substitute. Upto and incl 9 appearances you get your basic wage (O3) multiplied by the result factor (columns L:N), but when you hit 10-19 appearance you get your basic * result outcome *1.05 and here's where I've got an error and getting a FALSE reply. Cell Q14 should return ((40*1.05)*1.05)=44.10. I know it is something obvious, but I can't work it out.

Please can someone take a look and point me in the correct direction or ask for more info if you need it.
 

Attachments

  • wages screen.png
    wages screen.png
    74.5 KB · Views: 11

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Affo
It's a long complex formula, getting a false suggests you have missed putting in one of the result options for one of the levels of ifs... ie if(exp,true,false)
I usually build long complex things like this across multiple columns til I know I have the right result then put it all together in one column if necessary.
To fault find though excel has "Evaluate formula" under the formulas tab. give this a run and it may help find where you've missed an option.
 
Upvote 0
It would be easier for people to help you if you used xl2bb to post your examples instead of a screen capture. A screen capture can not be edited in excel without retyping everything (very time consuming).
 
Upvote 0
Hi Affo01,

It's that first "IF(P14<10" because row 14 and below all have Pnn =>10 and it looks like you've satisfied the "if true" part but have no "if false" part so it drops into one of those closing brackets at the end and gives FALSE.
 
Upvote 0
Wages 2021 idea2.xlsx
NOPQ
340
4
51.11144
Sheet1
Cell Formulas
RangeFormula
N5N5=L5+M5-1
P5P5=COUNT(O5)
Q5Q5=IF(P5<10,IF(O5=1,O$3*N5,IF(O5=0.5,(O$3*N5)/2,IF(AND(P5<21,P5>9),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.05,IF(AND(P5>20,P5<31),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.1,IF(AND(P5>30,P5<41),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.15,IF(P5>40,IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.2,"")))))))))))))))


Have I managed to do that right from xl2bb?

The evaluate formulae didn't help much.
 
Upvote 0
This might help more, and thank you for your insights so far.

Cell Formulas
RangeFormula
P5P5=COUNT(O5)
Q5:Q13,Q16:Q22Q5=IF(P5<10,IF(O5=1,O$3*N5,IF(O5=0.5,(O$3*N5)/2,IF(AND(P5<21,P5>9),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.05,IF(AND(P5>20,P5<31),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.1,IF(AND(P5>30,P5<41),IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.15,IF(P5>40,IF(O5=1,O$3*N5,IF(O5=0.5,((O$3*N5)/2)*1.2,"")))))))))))))))
P6:P22P6=COUNT(O$5:O6)
Q14:Q15Q14=IF(P14<10,IF(O14=1,O$3*N14,IF(O14=0.5,(O$3*N14)/2,IF(AND(P14>9,P14<21),IF(O14=1,O$3*N14,IF(O14=0.5,((O$3*N14)/2)*1.05,IF(AND(P14>20,P14<31),IF(O14=1,O$3*N14,IF(O14=0.5,((O$3*N14)/2)*1.1,IF(AND(P14>30,P14<41),IF(O14=1,O$3*N14,IF(O14=0.5,((O$3*N14)/2)*1.15,IF(P14>40,IF(O14=1,O$3*N14,IF(O14=0.5,((O$3*N14)/2)*1.2,"")))))))))))))))
N5:N22N5=L5+M5-1
 
Upvote 0
Last edited:
Upvote 0
Yes, that looks correct so far, but when they get to 20 appearances in column P, the multiplier needs to be 1.1 and if they hit 30, 1.15 and for 40 and above 1.2 if that makes sense? I fear that is where my initial attempt failed with all the IFs and ANDs.

But thank you so far, I can see how you simplified the first part at least.
 
Upvote 0
I think that you might have missed the edit that I made, I noticed that after posting and changed the formula in my reply above.
 
Upvote 0
Yes, sorry I did miss your edit, must have been typing my reply, but that looks absolutely perfect. Never knew about FLOOR! I like learning new things and will have to look more into how that works.

Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top