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>
 
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
LABOR
4/11/2018
LABOR
3
5
RCPT
4/11/2018
04112018 02
1
6
INV
4/11/2018
04112018 03
1
7
LABOR1
4/12/2018
LABOR1
5
8
DOC
4/11/2018
04112018 04
1

<tbody>
</tbody>

















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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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.

ABCM
1TypeDateIDRate
2DOC4/11/201804112018 011
3DOC4/11/201804112018 021
4LABOR4/11/2018LABOR3
5RCPT4/11/201804112018 041
6INV4/11/201804112018 051
7LABOR14/11/2018LABOR15
8DOC4/11/201804112018 071

<tbody>
</tbody>
 
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,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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