Formula based on What List Number equals...

gvillepa

New Member
Joined
Oct 18, 2017
Messages
36
Hi,

I defined a list (1,2,3,4,5,6,7,8,9,10,11,12,13) which represents Week Number for a sales goal attainment report.

Based on what the user selects, it uses a formula to sum that number of weeks cumulative goal and sums that number of weeks actual sales.

It's a long formula and curious if there were better ways of doing this.

Here's the formula, where cell D10 = the defined list number of 1 thru 13.

You'll notice cells aren't adjacent, but i can make them adjacent if it helps for an easier formula. Thanks!

=IF($D$10=1,I2,IF($D$10=2,(I2+K2),IF($D$10=3,(I2+K2+M2),IF($D$10=4,(I2+K2+M2+O2),IF($D$10=5,(I2+K2+M2+O2+Q2),IF($D$10=6,(I2+K2+M2+O2+Q2+S2),IF($D$10=7,(I2+K2+M2+O2+Q2+S2+U2),IF($D$10=8,(I2+K2+M2+O2+Q2+S2+U2+W2),IF($D$10=9,(I2+K2+M2+O2+Q2+S2+U2+W2+Y2),IF($D$10=10,(I2+K2+M2+O2+Q2+S2+U2+W2+Y2+AA2), IF($D$10=11,(I2+K2+M2+O2+Q2+S2+U2+W2+Y2+AA2+AC2),IF($D$10=12,(I2+K2+M2+O2+Q2+S2+U2+W2+Y2+AA2+AC2+AE2),IF($D$10=13,(I2+K2+M2+O2+Q2+S2+U2+W2+Y2+AA2+AC2+AE2+AG2))))))))))))))
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Maybe this simpler formula

=SUMPRODUCT(--(MOD(COLUMN(I2:AG2)-COLUMN(I2)+1,2)=1),--(COLUMN(I2:AG2)-COLUMN(I2)+1<=2*D10-1),I2:AG2)

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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