+ Reply to Thread
Results 1 to 11 of 11

Please help - School Project - Trying to setup function.

  1. #1
    Registered User
    Join Date
    04-19-2021
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Office 365
    Posts
    40

    Please help - School Project - Trying to setup function.

    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

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Please help - School Project - Trying to setup function.

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Quang PT

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Please help - School Project - Trying to setup function.

    crosspost: https://www.mrexcel.com/board/thread...ction.1168589/

    https://www.excelguru.ca/forums/show...setup-function

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    04-19-2021
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Office 365
    Posts
    40

    Re: Please help - School Project - Trying to setup function.

    Thank you for reminding me of the rules, I will keep that in mind in the future. I have posted an example in another Forum which was:

    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:

    For ID 4 Does Apple come before Emerald, if yes, how many days between end date for Apple and Start date for Emerald.
    Attached Files Attached Files

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Please help - School Project - Trying to setup function.

    Your "example" in the text does not tally with the sheet. You have given us NO IDEA where/how you want the results displayed.

    re-post your sheet showing some manually calculated resutls WHERE you want them to appear. Do not describe in words situations that DO NOT exist in your sheet.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  6. #6
    Registered User
    Join Date
    04-19-2021
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Office 365
    Posts
    40

    Re: Please help - School Project - Trying to setup function.

    Sorry if my post is confussing, I tried updating the worksheet.
    Attached Files Attached Files

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Please help - School Project - Trying to setup function.

    It's still confusing for me.... If X comes before Y... How do you choose X? How do you choose Y?

    So for ID 2 there are 4 unique entries... How do you know which one you are choosing to be X? How do you know which one you are choosing to be Y?

    You did not add manually calculated expected results to the sheet, as requested.

    Please do so this time.

  8. #8
    Registered User
    Join Date
    04-19-2021
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Office 365
    Posts
    40

    Re: Please help - School Project - Trying to setup function.

    I have a large dataset where I am going to set some conditions on which words to prioritize. So I am setting the conditions to check whether: "A, B, C" comes before "X, Z, Y". I am unsure on what you mean by expected results. I am interested in learning, if the conditions are met, how many days would there be between the end of event 1 (Names) and the start of event 2.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Please help - School Project - Trying to setup function.

    Sorry. I have no idea what you want.

    I'm out.

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Please help - School Project - Trying to setup function.

    How to know Bread in B3 and Apple in B2, who come first? Base on Start date or End date? Should the results put in E2 downwards?
    Try to put your expected results in where they should be, and explain how it is calculated.
    Good luck.

  11. #11
    Registered User
    Join Date
    04-19-2021
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Office 365
    Posts
    40

    Re: Please help - School Project - Trying to setup function.

    Those are just examples that I put in. I want to code it like: IF("ID"=1,Apple > Bread" date). So for ID = 1, if Apple appears before bread for the given ID, then it should check the dates.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. University Project for Transportation school bus
    By Total32 in forum Excel General
    Replies: 6
    Last Post: 10-20-2017, 12:53 PM
  2. School Project
    By iserve in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2012, 03:52 PM
  3. Need help on VBA code for school project!
    By rollintide89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2011, 06:38 AM
  4. O/T: Help with B-school project
    By rhyan66 in forum The Water Cooler
    Replies: 1
    Last Post: 08-05-2009, 09:55 AM
  5. school project ..please help
    By sally in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-20-2006, 09:10 AM
  6. school project ..please help
    By sally in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-19-2006, 02:55 PM
  7. [SOLVED] school project ..please help
    By sally in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-19-2006, 12:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1