Combine 2 formula into/be i formula - rick's formula

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all....

i want to combine 2 formula into 1 formula (Rick's formula)

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]data (col.a)[/TD]
[TD]result after use formula A[/TD]
[TD]result after use formula B[/TD]
[TD]single formula (combine) ??[/TD]
[/TR]
[TR]
[TD]08/12/2005 (as date)[/TD]
[TD]2005-12-08[/TD]
[TD]2005[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/07/1992 (as date)[/TD]
[TD]1992-07-01[/TD]
[TD]1992[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1986-7-45 (as text)[/TD]
[TD]1986-7-45[/TD]
[TD]1986[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2001-10-380 (as text)[/TD]
[TD]2001-10-380[/TD]
[TD]2001[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

formula A :
Code:
[COLOR=#333333]=IF(COUNTIF(A1,"*-*"),A1,TEXT(A1,"yyyy-mm-dd"))[/COLOR]

http://www.mrexcel.com/forum/excel-...-number-different-format-date-vs-general.html

then
formula B
Code:
=LEFT(B1,4)+(--LEFT(B1,4)=2010)*(--SUBSTITUTE(MID(B1,5,3),"-","")>6)

http://www.mrexcel.com/forum/excel-questions/880218-extract-some-number-year-2.html

how do make it. It's possible?

thank in advance..

m.susanto
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try

=LEFT(IF(COUNTIF(A1,"*-*"),A1,TEXT(A1,"yyyy-mm-dd")),4)+(--LEFT(IF(COUNTIF(A1,"*-*"),A1,TEXT(A1,"yyyy-mm-dd")),4)=2010)*(--SUBSTITUTE(MID(IF(COUNTIF(A1,"*-*"),A1,TEXT(A1,"yyyy-mm-dd")),5,3),"-","")>6)
 
Upvote 0
hi all....

i want to combine 2 formula into 1 formula (Rick's formula)

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]data (col.a)[/TD]
[TD]result after use formula A[/TD]
[TD]result after use formula B[/TD]
[TD]single formula (combine) ??[/TD]
[/TR]
[TR]
[TD]08/12/2005 (as date)[/TD]
[TD]2005-12-08[/TD]
[TD]2005[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]01/07/1992 (as date)[/TD]
[TD]1992-07-01[/TD]
[TD]1992[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1986-7-45 (as text)[/TD]
[TD]1986-7-45[/TD]
[TD]1986[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2001-10-380 (as text)[/TD]
[TD]2001-10-380[/TD]
[TD]2001[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
It is not clear to me what you want the combined formula to output... can you fill in the "single formula (combine)" column so we can see what you want?
 
Upvote 0
hi guys..it works for me

Code:
=IF(ISNUMBER(A2);IF(AND(A2>=DATE(2010;7;1);A2<=DATE(2010;12;31));2011;YEAR(A2));IF(AND(--LEFT(A2;4)=2010;--MID(A2;6;2)>=7);2011;LEFT(A2;4)))

any more shorter? or other idea?
 
Upvote 0
Using Rick's solution, try

=IF(AND(ISNUMBER(A2),A2>=DATE(2010,7,1),A2<=DATE(2010,12,31)),2011,0+LEFT(TEXT(A2,"yyyy"),4))
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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