Convert the first negative value to months and 0 to subsequent negative value, else convert the next negative value to months

jns1087

New Member
Joined
May 3, 2020
Messages
13
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hi Guys,


Can i ask for help with this, I'm playing with this formula and can't get it done properly. me and chatgpt are running in circles for hours, anyway.

I have this formula that i want to convert the first negative source value (Column C) into months from data on Col. B, then the subsequent negative values (Column C) will display only as 0, the only thing that the subsequent value will change when the first negative value becomes positive.

Col ACol BCol CCol DCol ECol FCol GCol H
MonthDateSource ValueValue Converted monthGoal: Put the month value for the first negative source value, and 0 to subsequent negative values, else if the first negative value became positive it will turn into 0, then the next negative value will result to its corresponding monthResultSubsequent Result
if first negative value turn to positive
Subsequent Result
if second negative value turn to positive
Jan
1/1/2023​
101000
Feb
2/1/2023​
-5020200
Mar
3/1/2023​
003000
Apr
4/1/2023​
204000
May
5/1/2023​
305000
Jun
6/1/2023​
506000
Jul
7/1/2023​
-10070070
Aug
8/1/2023​
008000
Sep
9/1/2023​
-20090009
Oct
10/1/2023​
0010000
Nov
11/1/2023​
6011000
Dec
12/1/2023​
7012000
=IF(SUM(C2)<0,MONTH(B2),0)=IF(C2<0,0,MONTH(B2))



thanks,
jns
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Like this?

Book1
ABCDEFG
1MonthDateSource valueresultSubsequentSubsequentSubsequent
2January01/01/202310000
3February01/02/2023-502000
4March01/03/202300000
5April01/04/202320000
6May01/05/202330000
7June01/06/202350000
8July01/07/2023-1000700
9August01/08/202300000
10September01/09/2023-2000090
11October01/10/202300000
12November01/11/202360000
13December01/12/2023-30000012
Sheet1
Cell Formulas
RangeFormula
D2:G13D2=IF(COUNTIFS($C$2:C2,"<0")=COLUMN()-3,IF($C2<0,MONTH($B2),0),0)
 
Upvote 0
Solution
Like this?

Book1
ABCDEFG
1MonthDateSource valueresultSubsequentSubsequentSubsequent
2January01/01/202310000
3February01/02/2023-502000
4March01/03/202300000
5April01/04/202320000
6May01/05/202330000
7June01/06/202350000
8July01/07/2023-1000700
9August01/08/202300000
10September01/09/2023-2000090
11October01/10/202300000
12November01/11/202360000
13December01/12/2023-30000012
Sheet1
Cell Formulas
RangeFormula
D2:G13D2=IF(COUNTIFS($C$2:C2,"<0")=COLUMN()-3,IF($C2<0,MONTH($B2),0),0)

yes it works on my expectation! i dont know how that happen
 
Upvote 0
Like this?

Book1
ABCDEFG
1MonthDateSource valueresultSubsequentSubsequentSubsequent
2January01/01/202310000
3February01/02/2023-502000
4March01/03/202300000
5April01/04/202320000
6May01/05/202330000
7June01/06/202350000
8July01/07/2023-1000700
9August01/08/202300000
10September01/09/2023-2000090
11October01/10/202300000
12November01/11/202360000
13December01/12/2023-30000012
Sheet1
Cell Formulas
RangeFormula
D2:G13D2=IF(COUNTIFS($C$2:C2,"<0")=COLUMN()-3,IF($C2<0,MONTH($B2),0),0)
thank you again!!!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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