Need help with an IF/THEN formula to include AND in addition to a date lookup

Trinkit

New Member
Joined
Jun 16, 2019
Messages
4
I am new to this forum, so I apologize if this question has already been addressed. Here is what I am attempting to do:

IF the content of cell "A" AND the date (the year only) in cell "B"
THEN
the content of cell "C" is inserted into cell "D".

An example:
"B" "A" "C" "D"
5/10/2019 Med $10.00

The date is formated to read 10May19

Thank you so much for any and all assistance.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I not sure that I compute your example, but this might help you.
It will check if the year in column B is same as the year column A and then copy text from C to D.

Code:
Sub doit()
 For Each c In Range("B2:B50") 'Change to last row
    If Year(c) = Year(c.Offset(0, -1)) Then c.Offset(0, 2).Value = c.Offset(0, 1).Value
 Next c
End Sub
 
Upvote 0
It appears that when I posted my example, things got a little disoriented. Let me try to explain a little better: "B" is the date (5/10/2019); "A" is the text "Med"; "C" is currency "$10.00" and "D" was a blank cell where I wanted the formula to calculated.
 
Upvote 0
Hi & welcome to MrExcel.
Can you explain what you mean by
IF the content of cell "A" AND the date (the year only) in cell "B"
 
Upvote 0
Is it based on any conditions? For example do you want the content of cell C to be put into cell D only if the cell B is "Med" AND cell A is 2019, and not another word/date?
 
Upvote 0
yes, that is exactly what I want - the amount needs to be put into cell D ONLY if the other 2 conditions are met
 
Upvote 0
How about
=IF(AND(YEAR(A1)=2019,B1="Med"),C1,"")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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