Help with sum function

Shweta

Well-known Member
Joined
Jun 5, 2011
Messages
514
Hi All,

Please help me out on the below query

W5W4W3W2W1W0Result
28 L 30 L 22 0 80
8 7 9 11 7 0 27

<colgroup><col span="6"><col></colgroup><tbody>
</tbody>

In the result column, I want the sum for the last 4 weeks. If "L" is written in a column then formula should take the value from the next column but the count of the columns should not exceed 4.

For example in first case 0+22+30+28 = 80
in second case 0+7+11+9 = 27.

Please provide me an appropriate formula for this.

Thanks in advance!

Regards,
Shweta
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If there may be less than 4 numbers...try this regular formula:
Code:
G2: =SUM(F2:INDEX(2:2,INDEX(LARGE((A2:F2<"")*COLUMN(A2:F2),MIN(COUNT(A2:F2),4)),0)))
Copy that formula down as far as you need.

Is that something you can work with?
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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