Can Excel COPY DATE Values from one cell to another in MMDDYEAR format

NEW_2VBA

Board Regular
Joined
Dec 15, 2015
Messages
106
Is there an IF formula that stipulates if cell A contains the word "DOC" then Cell C will populate the date in MMDDYEAR format? Also if there are additional instances of the date being used it would need to add 01, 02, etc. after the date. Thanks!

[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD]Type[/TD]
[TD]Date[/TD]
[TD]ID[/TD]
[/TR]
[TR]
[TD]DOC[/TD]
[TD]4/11/18[/TD]
[TD]04112018[/TD]
[/TR]
[TR]
[TD]DOC[/TD]
[TD]4/11/18[/TD]
[TD]04112018 01[/TD]
[/TR]
[TR]
[TD]DOC[/TD]
[TD]4/11/18[/TD]
[TD]04112018 02[/TD]
[/TR]
</tbody>[/TABLE]
 
[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Type
[/TD]
[TD]Date
[/TD]
[TD]ID
[/TD]
[TD]Rate
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]DOC
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]DOC
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 01
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]LABOR
[/TD]
[TD]4/11/2018
[/TD]
[TD]LABOR
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]RCPT
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 02
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]INV
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 03
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]LABOR1
[/TD]
[TD]4/12/2018
[/TD]
[TD]LABOR1
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]DOC
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 04
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

















The ID should only calculate MMDDYEAR if the Type is = DOC, RCPT, or INV and if the Rate = 1 (sometimes the rate is different for those categories).
 
Last edited:
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
So it appears that the issue is that it isn't returning anything for the rows that don't meet that criteria.
That is simply because the FALSE argument of the IF formula is telling it to return blank "".
That is a simple fix:
Code:
=IF(AND(M2=1,OR(A2="DOC",A2="RCPT",A2="INV")),TEXT(B2,"mmddyyyy ") & TEXT(COUNTIF(B$2:B2,B2),"00"),[COLOR=#ff0000]A2[/COLOR])
 
Upvote 0
Thanks! It populates in the MMDDYEAR format correctly but the sequence count is off.

[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]M[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Type[/TD]
[TD]Date[/TD]
[TD]ID[/TD]
[TD]Rate[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]DOC[/TD]
[TD]4/11/2018[/TD]
[TD]04112018 01[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]DOC[/TD]
[TD]4/11/2018[/TD]
[TD]04112018 02[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]LABOR[/TD]
[TD]4/11/2018[/TD]
[TD]LABOR[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]RCPT[/TD]
[TD]4/11/2018[/TD]
[TD]04112018 04[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]INV[/TD]
[TD]4/11/2018[/TD]
[TD]04112018 05[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]LABOR1[/TD]
[TD]4/11/2018[/TD]
[TD]LABOR1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]DOC[/TD]
[TD]4/11/2018[/TD]
[TD]04112018 07[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Try:
Code:
=IF(AND(M2=1,OR(A2="DOC",A2="RCPT",A2="INV")),TEXT(B2,"mmddyyyy ") & TEXT(COUNTIFS(B$2:B2,B2,A$2:A2,"DOC")+COUNTIFS(B$2:B2,B2,A$2:A2,"RCPT")+COUNTIFS(B$2:B2,B2,A$2:A2,"INV"),"00"),A2)
 
Upvote 0
Hello, just wondering -- Is it possible to edit the formula to populate in MMDDYEAR format without the sequence for the first occurrence? So instead of populating "MMDDYEAR 00" format for the first cell that meets the criteria it would instead populate MMDDYEAR format then add 01, 02, to subsequent cells that meet criteria. [04112018, then 04112018 01, etc.]
 
Upvote 0
Try this:
Code:
=IF(AND(M2=1,OR(A2="DOC",A2="RCPT",A2="INV")),TEXT(B2,"mmddyyyy") & SUBSTITUTE(TEXT(COUNTIFS(B$2:B2,B2,A$2:A2,"DOC")+COUNTIFS(B$2:B2,B2,A$2:A2,"RCPT")+COUNTIFS(B$2:B2,B2,A$2:A2,"INV")-1," 00")," 00",""),A2)

I hope this is the last one! This formula is getting a bit messy...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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