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!

TypeDateID
DOC4/11/1804112018
DOC4/11/1804112018 01
DOC4/11/1804112018 02

<tbody>
</tbody>
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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
A
B
C
M
1
Type
Date
ID
Rate
2
DOC
4/11/2018
04112018
1
3
DOC
4/11/2018
04112018 01
1
4
RCPT
4/11/2018
04112018 03
1
5
INV
4/11/2018
04112018 04
1

<tbody>
</tbody>










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,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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