Nesting 12 if functions, How?

Amy from Charlotte

New Member
Joined
Mar 10, 2003
Messages
4
I am trying to nest 12 if functions with no success, I have read several other posts regaring this and have tried some of the suggested formulas but still can't get it to work right, please help! :rolleyes:

Here is the formula:
=(IF($AF$74=1,B78,"")&IF($AF$74=2,SUM(B78:C78),"")&IF($AF$74=3,SUM(B78:D78),"")&IF($AF$74=4,SUM(B78:E78),"")&IF($AF$74=5,SUM(B78:F78),"")&IF($AF$74=6,SUM(B78:G78),"")&IF($AF$74=7,SUM(B78:H78),"")&IF($AF$74=8,SUM(B78:I78),"")&IF($AF$74=9,SUM(B78:J78),"")&IF($AF$74=10,SUM(B78:K78,"")))

So the idea is that if cell equals 1 then return a value, if cell equals 2 then sum 2 values and return, if cell equals 3 then sum 3 values and return. When I enter the formula above I get a #VALUE error. What am I doing wrong?

Thanks!!! :rolleyes: :rolleyes:
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
=SUM(OFFSET(B78,,,AF74))

Addendum

As Oaktree pointed out I had missed a comma - Grrrrrr - Serves me right for just typing it and not trying it. :oops:

=SUM(OFFSET(B78,,,,AF74))
 
Upvote 0
Try = sum(B78:eek:ffset(B78,0,$af$74-1))

edit: I like Ken's more, but I think his should have 4 commas instead of 3

=SUM(OFFSET(B78,,,,AF74))
 
Upvote 0
The reason it isn't working, is that the & operator makes it text not number, even though it looks like a number.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,150
Members
448,552
Latest member
WORKINGWITHNOLEADER

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