Alternate Calculation based on the content of a cell

Krieger

New Member
Joined
Jan 27, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
This is my first post on here, so my apologies if this has been answered before. I am struggling with how to phrase my question so googling for an answer has not been terribly successful.

Anyhow, I am building a spreadsheet to calculate annual updates to pensions, and the calculation changes when someone turns 60 or 65.

In short, I want a formula that will reference a cell containing the age, and if under that age does one calculation, and if over, another calculation.

If column A contains 'pension', B contains 'age' and C contains sex (M/F), I want column D to show the answer to A x E, or A x F, depending on whether the value in B is 60 or over (if female), or if B is 65 or over (if Male).
The age at which the calculation changes basis is 60 for female and 65 for male, so if the calculation could also recognise the content of column C and act accordingly, that would be marvellous. Otherwise, I would stick with a separate worksheet for each sex and a simpler formula.

Hopefully this makes sense. I am grateful for your help.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
If column A contains 'pension', B contains 'age' and C contains sex (M/F), I want column D to show the answer to A x E, or A x F, depending on whether the value in B is 60 or over (if female), or if B is 65 or over (if Male).
an IF or Nested IF should do

=IF ( AND( A2="pension", B2 > = 60 , C2 = "female") , A2*E2 , IF ( AND( A2="pension", B2 > = 65 , C2 = "Male") , A2*F2 , "not pension age'))
BUT
A has Pension in so the
A2*E2 or A2 * F2 - is not going to work
If column A contains 'pension',
show the answer to A x E, or A x F,
can you explain in a little more detail
Here I have used H instead of A

Book3
ABCDEFGH
1
2Pension60Female12112
3Pension63Female12112
4Pension65Female12112
5Pension60malenot pension age112
6Pension63malenot pension age112
7Pension65male361312
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=IF(AND(A2="pension",B2>=60,C2="female"),H2*E2,IF(AND(A2="pension",B2>=65,C2="Male"),H2*F2,"not pension age"))
 
Last edited:
Upvote 0
Thankyou for your reply - I am happy to clarify.
Column A will contain a pension amount in £.
Columns E and F will contain different factors, for example:
A = £200, E = 1.5, F = 1.8.
In column D then:
- If male and under 65 I want A x E (£300)
- If male and over 65 I want A x F (£360)
- If female and under 60 I want A x E (£300)
- If female and over 60 I want A x F (£360)
 
Upvote 0
OK,
There will be a better way to do this - BUT staying with the Nested IF

=IF(AND(B2>=60,C2="female"),A2*F2,IF(AND(B2<60,C2="female"),A2*E2,IF(AND(B2>=65,C2="male"),A2*F2,IF(AND(B2<65,C2="male"),A2*E2,"Error"))))

I have added the error at the end, so if something not entered correctly of blank - BUT that can be changed to ""


Book3
ABCDEFGHI
1
220050Female3001.51.8
320063Female3601.51.8
420065Female3601.51.8
520060male3001.51.8
620065male3601.51.8
720070male3601.51.8
8Error
9
10Column A will contain a pension amount in £. Columns E and F will contain different factors, for example: A = £200, E = 1.5, F = 1.8. In column D then: - If male and under 65 I want A x E (£300) - If male and over 65 I want A x F (£360) - If female and under 60 I want A x E (£300) - If female and over 60 I want A x F (£360)
11
12
13
14
15
16
17
18
Sheet1
Cell Formulas
RangeFormula
D2:D8D2=IF(AND(B2>=60,C2="female"),A2*F2,IF(AND(B2<60,C2="female"),A2*E2,IF(AND(B2>=65,C2="male"),A2*F2,IF(AND(B2<65,C2="male"),A2*E2,"Error"))))
 
Upvote 0
Hi,

Try this also:

Book3.xlsx
ABCDEF
1PensionAgeGenderResultUnderEqual & Over
220061M3001.51.8
325065M4251.41.7
420060F3601.51.8
525059F3501.41.7
Sheet963
Cell Formulas
RangeFormula
D2:D5D2=A2*IF(OR(AND(B2<65,C2="M"),AND(B2<60,C2="F")),E2,F2)
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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