School project - Need help to setup function.

Enigma909

New Member
Joined
Apr 19, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello I am writing a school project and I am having trouble setting up a function.

I have some unique ID’s in the first column, different names in the second column, start dates in the third column and end dates in the fourth column.

I am trying to create a function that says for unique ID “1”, if name “A” comes before name “B” what is the difference between end date “A” and start date “B”. I hope this makes sense.

I was thinking about using an IF AND function but I can’t make it work.

An example could be: For ID “1” if “Apple” appears before “Pears” what is the difference between 01.02.19 and 04.02.19.
The function should return: 3 days in a new column, and it should then continue to the next unique “ID” which is “2”.

I really hope that you can help me.

Best regards
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
This will get you going, place the code in the cell you want to display the number of days between dates:

Excel Formula:
=IF(B2<=A2,DAYS(D2,C2),"")
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at:

If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
hi @mabbutt thank you for your answer.

The problem I am having is that I have 80 k rows + and that I need to code them on names and not on cells. The Formula would work perfectly if dont for a few cells. For example:
1618906883938.png


For ID 4 Does Apple come before Emerald, if yes, how many days between end date for Apple and Start date for Emerald.
 
Upvote 0
If you provide the code or formulas you have already and show how far you have got then it'll be easier for someone to help you.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,862
Members
449,052
Latest member
Fuddy_Duddy

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