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]
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
And what should it populate if column A does not equal "DOC"?

Assuming that your data starts on row 2, here is a formula what will do what you want, and return nothing (blank) if column A is not equal to "DOC".
Place this in cell C2 and copy down for all rows:
Code:
=IF(A2="DOC",TEXT(B2,"mmddyyyy ") & TEXT(COUNTIFS(A$2:A2,A2,B$2:B2,B2),"00"),"")
 
Last edited:
Upvote 0
Hello! I attempted to add additional conditions to this but it works partially; it adds the value MMDDYEAR but doesn't count the new specified values included in the OR portion of the formula. Can anyone help me pinpoint my error?

=IF(AND(M2=1,OR(A2="DOC",A2="RCPT",A2="INV")),TEXT(B2,"mmddyyyy ") & TEXT(COUNTIFS(A$2:A2,A2,B$2:B2,B2),"00"),"")
 
Upvote 0
I am a very visual person.
Can you post some examples, like in your initial post, along with expected results, so we can better understand exactly what you are looking for.
 
Upvote 0
[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]RCPT
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 03
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]INV
[/TD]
[TD]4/11/2018
[/TD]
[TD]04112018 04
[/TD]
[TD]1
[/TD]
[/TR]
</tbody>[/TABLE]










Hope this helps, thanks!
 
Last edited:
Upvote 0
OK, so you do not want each Type to have its own separate sequence (they should all be treated the same).
Try this:
Code:
=IF(AND(M2=1,OR(A2="DOC",A2="RCPT",A2="INV")),TEXT(B2,"mmddyyyy ") & TEXT(COUNTIF(B$2:B2,B2),"00"),"")
 
Upvote 0
Thanks. That formula seemed to count every line item with the same date and include it in the sequence without looking at columns A & M.
 
Upvote 0
Isn't that what your example up in post 7 shows?
If not, then please explain the logic regarding how to arrive that you want column C to show.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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