+ Reply to Thread
Results 1 to 30 of 30

Formula with date

  1. #1
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Formula with date

    Dear All

    Encl pls find the table which contains two worksheet.
    One worksheet base file name Base file
    Other one name BAF file.

    The goal is to get the data from BAF file which accordingly to the date period to fit into the Base file whenever I type the date on start date (from), then it will show the BAF value automatically.

    I would like to set up simple formula which does not need to use VBA & also pls use as simple formula as possible.

    Did anyone can assist ?

    Tks in advance.

    Beginner !
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Formula with date

    Try this...
    =IFERROR(VLOOKUP(E2,'BAF file'!$E$2:$G$5,3,0),"")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Formula with date

    in your file the information in columns A, B, C and D are the same in both tabs. Will this always be the case or will what you want in the Base File tab have to match on more information than the "From" and "To" date fields?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

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

    Re: Formula with date

    If I understand correctly, then

    =INDEX('BAF file'!$G$2:$G$5,MATCH('Base File'!E2,'BAF file'!$E$2:$E$5,1))

    in G1 and copy down.
    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

  5. #5
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FDibbins View Post
    Try this...
    =IFERROR(VLOOKUP(E2,'BAF file'!$E$2:$G$5,3,0),"")
    Tks for your reply but it does not work for the date on row 2 since the date is not on 1/4 (is from 16/4).
    Actually, the data in BAF file can be from 1/4 to 30/6 & I want to get the value in Base file which I type in the date from & to, then they can find those data in between those date.

  6. #6
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by Sambo kid View Post
    in your file the information in columns A, B, C and D are the same in both tabs. Will this always be the case or will what you want in the Base File tab have to match on more information than the "From" and "To" date fields?
    In the real file which are many column in between those file, which means that it will have many other information.
    In A,B,C,D,E,F which are the information which affect the BAF value.
    IN BAF table which has date validity, it can be either 1/4 to 2/4 or 1/4 to 30/6.
    I would like need to key in the base file From & TO, then it need to find the result from BAF table base on those range.

    Hope it's clear ?!

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    It returns the same as alansidman's (Post #4).
    Last edited by FlameRetired; 04-09-2019 at 01:42 PM.
    Dave

  8. #8
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by alansidman View Post
    If I understand correctly, then

    =INDEX('BAF file'!$G$2:$G$5,MATCH('Base File'!E2,'BAF file'!$E$2:$E$5,1))

    in G1 and copy down.
    Dear Alan

    Great with tks. I think it's exactly the answer that I am try to look for the date solution.
    However, would you help to made the formula which can combine with the data on column A,B,C,D too ?
    I can combine all those column : A2&B2&C2&D2 into new column : H so that it need to match with those information too.

    Tks in advance !

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

    Re: Formula with date

    I am not understanding your issue. Please clarify with a step by step narration of what you want to accomplish as this is new information that was not spelled out in the original post.

  10. #10
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Dear Dave,

    Tks. The result is the same but if I add the row with Jun rate on Base file which it does not change the value for Jun so I think the formula is better on Post 4 - Alan as it's change automatically.

    But anyway, appreciate your help !

  11. #11
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Formula with date

    perhaps you could upload a new file with more representative data AND expected results with the explanation?

  12. #12
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by alansidman View Post
    I am not understanding your issue. Please clarify with a step by step narration of what you want to accomplish as this is new information that was not spelled out in the original post.
    Dear Alan

    I att'd update file for your reference.
    In fact, beside those date, I need the data(value) match with ABCD column so I create the column H.
    (I think this is the solution to create the formula link between BAF file & Base file to have the same information.)
    If you think that it does not need it which will be more great !

    Tks in advance !
    Ale
    Attached Files Attached Files

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    There are extra spaces in the concatenated text in both sheets column H, and they are inconsistent.

    FEMED CMADry will not match FEMED CMA Dry.

    I cleaned those up and this works.

    In the attached please see
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FlameRetired View Post
    There are extra spaces in the concatenated text in both sheets column H, and they are inconsistent.

    FEMED CMADry will not match FEMED CMA Dry.

    I cleaned those up and this works.

    In the attached please see
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dear FlameRetired

    Tks for your formula, i tried in my real file & it's work !!!! I had made some amendment due to the worksheet can't show N/A message which easy to solve with IFERROR.

    Thank you so much !

    Best Regards
    Ale

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    You are welcome. Glad to help.

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

    Re: Formula with date

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  17. #17
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FlameRetired View Post
    You are welcome. Glad to help.
    Dear FlameRetired

    After I entre the whole data & found out there is some problem.

    In the base file, If I put the date from 1/3 to 31/3 & 1/4 to 31/5.
    In the BAF rate i had two rate from 1/3 to 31/3 & 1/4 to 30/6,
    the rate from 1/3 to 31/3 which has no problem to show, but the rate from 1/4 to 31/5 which they show error message.

    On the other hand, I had the second case that I delete the third critiea (F2<='BAF file'!$F$2:$F$8) & put the date only from 1/3 to 31/3.
    Afterward, I add the date from 1/4 to 31/5 & the value will show only 1/3 to 31/3. It can show the BAF rate from 1/4.

    Can you help one more time how to amend the formula that it can show two period in the table ?

    I att'd the file again for your reference.

    Tks & Rgds
    Ale
    Attached Files Attached Files
    Last edited by aleman_li; 04-15-2019 at 07:49 AM. Reason: att'd the file for example

  18. #18
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FlameRetired View Post
    You are welcome. Glad to help.
    Dear FlameRetired

    I have problem in formula again, pls find att'd file which has error message.
    Can you assist to solve it ?

    Basically it's because there are two period of date from BAF table & I will put the date range from Base file. It need to extract the data correctly in the Base file;

    Tks again in advance
    Ale
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    04-15-2019
    Location
    usa
    MS-Off Ver
    2013
    Posts
    8

    Re: Formula with date

    If I understand correctly, then

    =INDEX('BAF file'!$G$2:$G$5,MATCH('Base File'!E2,'BAF file'!$E$2:$E$5,1))

    in G1 and copy down.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,448

    Re: Formula with date

    Why did you copy another member's post? Your behaviour here is suspicious - be aware that I have my eye on you.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  21. #21
    Registered User
    Join Date
    04-15-2019
    Location
    usa
    MS-Off Ver
    2013
    Posts
    8

    Re: Formula with date

    ok I'm sorry

  22. #22
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    aleman_li,

    Please try array entering this formula in G2 and fill down.

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    E
    F
    G
    H
    1
    From
    To
    BAF
    helper 1
    2
    4/1/2019
    4/15/2019
    200
    FEMEDCMADry
    3
    4/16/2019
    4/30/2019
    200
    FEMEDCMADry
    4
    5/1/2019
    5/31/2019
    250
    FEMEDCMADry
    5
    3/1/2019
    3/31/2019
    150
    FEMEDCMADry
    6
    5/1/2019
    5/31/2019
    #NUM!
    FEMEDCMADry
    7
    6/1/2019
    6/30/2019
    275
    FEMEDCMADry
    8
    6/1/2019
    6/15/2019
    275
    FEMEDCMADry
    9
    6/1/2019
    6/30/2019
    300
    FEMEDMSCDRY
    10
    5/1/2019
    5/23/2019
    230
    FENCPMSCDRY
    11
    4/1/2019
    4/30/2019
    200
    NCPFEABCDRY
    12
    5/1/2019
    5/23/2019
    200
    NCPFEABCDRY
    13
    5/24/2019
    5/31/2019
    210
    NCPFEABCDRY
    14
    6/1/2019
    6/30/2019
    210
    NCPFEABCDRY

  23. #23
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Dear Dave

    Tks for your reply but it seems that the formula does not work.

    I att'd the file that after I input your forumla on it & the data is not the same as your print screen.
    Row 6 has error message with #NUM !" on it & other mistakes on the file.

    Fyi, I am using version 2016 which I don't know if it's the reason that the result is not the same.

    At the same time, when I type the formula which the sign (,) whcih need to type ( in order to pass the formula. It might be the version Windows is in French ?? As when I pass it to my colleague & I noticed that his version 2010 is using (,) too.
    But he send me back the file which the formula change back to ( automatically.

    =INDEX('BAF file'!$G$2:$G$9;SMALL(IF((H2='BAF file'!$H$2:$H$9)*((E2>='BAF file'!$E$2:$E$9)*(E2<='BAF file'!$F$2:$F$9)+(F2>='BAF file'!$E$2:$E$9)*(F2<='BAF file'!$F$2:$F$9));ROW($H$2:$H$9)-MIN(ROW($H$2:$H$9))+1);COUNTIFS(E$2:E2;E2;F$2:F2;F2;H$2:H2;H2)))

    When you use H2 which does not need to refer to BASE file but when I do the formula, it appears the long file name.
    Will it be any problem that I just use H2 like yours ?

    One last question, as the BAF file which actually is not only 9 rows.
    Can i use the column number to put into the formula so that it can cover all the data in that column?

    Tks your for your patience & really tks for your help in advance !
    Attached Files Attached Files

  24. #24
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    I am having difficulty understanding.

    Please upload a file with all desired results hand typed in. Perhaps I can figure out that way.

  25. #25
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FlameRetired View Post
    I am having difficulty understanding.

    Please upload a file with all desired results hand typed in. Perhaps I can figure out that way.

    Dear Dave,

    Encl pls find those file & my explaination on it.
    Hope it's clear !

    Tks & Rgds
    Ale
    Attached Files Attached Files

  26. #26
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    Thank you. That helped.

    Please check cell G9. I get 300 which I believe is correct.

    The enclosed will take care of the regional settings "," vs ";".

    The formula must be array entered --- Ctrl + Shift + Enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  27. #27
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Quote Originally Posted by FlameRetired View Post
    Thank you. That helped.

    Please check cell G9. I get 300 which I believe is correct.

    The enclosed will take care of the regional settings "," vs ";".

    The formula must be array entered --- Ctrl + Shift + Enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Dear Dave

    Tks for your renew formula but it's still have few problems as below:-


    1. I noticed that the row/line number in the formula need to match, example 9 rows in BAF table & BASE file table. However, in my real file, the rows number in BAF table which is 173 but my Base file row number which is nearly 18000.
    So I am not sure if it's this problem to cause some error.
    Also, when I add the line/row in BAF table, it seems that it need to include the new row/line number to extract the information. Is there any solution to avoid it ? (eg BAF table add one line for 10 & 11 which the result are not the same in Base file)

    2. When the data is not yet input it in BAF table (eg rate on July), it seems that they take the first record from the file which it's happen in my real file. Can it show error message N/A so that I can input the data.

    3. When the date on Base file which is 1/4 to 30/6 but the BAF file record has data from 1/4 to 30/4 but it show error message. I suppose it should show the Apr data on it.

    I encl the file & show in Orange colour & in RED on the cell itself with some explanation.

    Tks again for your effort !
    Rgds
    Ale
    Attached Files Attached Files

  28. #28
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Formula with date

    1. Since the range in 'BAF file has increased the ranges in the formula need to increase to include the new rows.
    2. However, in my real file, the rows number in BAF table which is 173 but my Base file row number which is nearly 18000.
      You hadn't mentioned that before. Array formulas are resource hungry. Too many of them will cause slow calculations if Excel can handle them at all.

    With all the added information and the complexities of returning overlapping dates (sometimes in the same 'group' (column H) and sometimes not) I am afraid I have exhausted all my ideas.

    I am sorry. I don't think I can be of further assistance.

  29. #29
    Registered User
    Join Date
    09-29-2014
    Location
    Lille, France
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Formula with date

    Dear Dave,

    Yesterday, i retried your formula & actually even the real file has 18000 line which they had no problem.

    I am just thinking the principal how to implement this formula & clear my idea. Might be you can still find the solution on it.

    Basically, in Base file, I just need to clarify the start date (no need to concern the end date) which is between the date from BAF table (from / to) or not.
    If it's in that range, then search for data which match with helper information.
    if not, then it's N/A
    The formula should allow add the new row information on both Base file & BAF file which will not affect the data.

    The problem should be if the data on BAF table has two months information (eg Mar & Apr) which the formula need to find which data should be in Base file accordingly.

    Anyway, Tks so much for your help & I hope that one day I can find the solution on it !

    B. Rgds
    Ale

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,448

    Re: Formula with date

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 4
    Last Post: 03-21-2018, 09:25 AM
  2. Replies: 7
    Last Post: 02-02-2017, 02:41 PM
  3. Replies: 5
    Last Post: 12-01-2015, 02:36 PM
  4. [SOLVED] Need FORMULA for Date subtract Date equal bussiness hour (don't count weekend)
    By tuongtu3 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-24-2015, 03:29 AM
  5. [SOLVED] Formula to compare date (including month and year) from a listed date to today's date
    By mhewitson15 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2014, 05:31 PM
  6. Replies: 2
    Last Post: 11-03-2014, 10:29 AM
  7. Replies: 1
    Last Post: 04-18-2012, 05:49 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