Formula Based Text based on certain criteria/range

suhas.sharma

New Member
Joined
Jan 10, 2012
Messages
8
Hello,

I am trying to get automated text (highlighted in color red) based on the selected range and need solution in cells which says Total (Apr-Dec) and Total (Feb-Nov). This label should be based on corresponding month where 1st value in counter row is 1 and corresponding month where last found value of 1 in counter row.

Something like "Total" & Formula & "-" & Formula for Total (Apr-Dec) based on range in counter row.

Thanks in advance genius's out there.

[TABLE="width: 1122"]
<tbody>[TR]
[TD][TABLE="width: 1122"]
<tbody>[TR]
[TD]Counter[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]Label[/TD]
[/TR]
[TR]
[TD]Month[/TD]
[TD]1-Jan-19[/TD]
[TD]1-Feb-19[/TD]
[TD]1-Mar-19[/TD]
[TD]1-Apr-19[/TD]
[TD]1-May-19[/TD]
[TD]1-Jun-19[/TD]
[TD]1-Jul-19[/TD]
[TD]1-Aug-19[/TD]
[TD]1-Sep-19[/TD]
[TD]1-Oct-19[/TD]
[TD]1-Nov-19[/TD]
[TD]1-Dec-19[/TD]
[TD]Total (Apr-Dec)[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$90,000[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Counter[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]Label[/TD]
[/TR]
[TR]
[TD]Month[/TD]
[TD]1-Jan-19[/TD]
[TD]1-Feb-19[/TD]
[TD]1-Mar-19[/TD]
[TD]1-Apr-19[/TD]
[TD]1-May-19[/TD]
[TD]1-Jun-19[/TD]
[TD]1-Jul-19[/TD]
[TD]1-Aug-19[/TD]
[TD]1-Sep-19[/TD]
[TD]1-Oct-19[/TD]
[TD]1-Nov-19[/TD]
[TD]1-Dec-19[/TD]
[TD]Total (Feb-Nov)[/TD]
[/TR]
[TR]
[TD]Revenue[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$10,000[/TD]
[TD]$100,000[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
If you have the AGGREGATE function (Excel 2010 and newer) try:

="Total ("&TEXT(AGGREGATE(15,6,B2:M2/B1:M1,1),"mmm")&"-"&TEXT(AGGREGATE(14,6,B2:M2/B1:M1,1),"mmm")&")"


Otherwise you can use this formula:

="Total ("&TEXT(INDEX(B2:M2,MATCH(1,B1:M1,0)),"mmm")&"-"&TEXT(LOOKUP(2,1/B1:M1,B2:M2),"mmm")&")"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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