+ Reply to Thread
Results 1 to 26 of 26

Automatic date formula

  1. #1
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Automatic date formula

    I have purchase data:
    2 Eiger Starter Daypack 16L Blue, purchased on 2 July 2023
    2 Eiger Starter Daypack 16L Olive, purchased on 2 July 2023
    2 Eiger Starter Daypack 16L Blue, purchased on 3 July 2023

    I want automatic formula in my sales data :
    If, 1 Eiger Starter Daypack 16L Blue sold on 5 July 2023, the purchase date will be shown 2 July 2023
    1 Eiger Starter Daypack 16L Blue sold on 6 July 2023, the purchase date will be shown 2 July 2023

    but
    If, 2 Eiger Starter Daypack 16L Blue sold from 1 buyer on 5 July 2023, the purchase date will be shown 2 July 2023
    1 Eiger Starter Daypack 16L Blue sold from 1 buyer on 5 July 2023, the purchase date will be shown 3 July 2023

    Kindly help.
    Thank you.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,216

    Re: Automatic date formula

    You need to explain the logic for selecting the purchase date i.e, why 2nd July for 5th July selling date?
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear John,

    I mean, if the item 1 Tripwalk navy is sold on 5 July, so the purchase date will be shown 2 July, and then if 1 Tripwalk navy is sold on 5 July, so the purchase date will be shown 2 July too because I purchased 2 Tripwalk Navy on 2 July.

    I have 2 sheets data : purchase data and sales data

    Thank you.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    "I have 2 sheets data : purchase data and sales data"
    Someone may be better able to understand what you want if we could see a sample of the two sheets.
    Information about attaching a workbook to your next post is given in the "HOW TO ATTACH YOUR SAMPLE WORKBOOK" banner at the top of the page.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jate,

    Here I attach the data.

    Thank you.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    I want a formula on sheet : Sales data, column : "Purchase Date" that is referenced from Purchase Data sheet.
    So I don't fill it manually.
    Thank you.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    This proposal employs two helper columns which may be hidden for aesthetic purposes.
    On the Purchase sheet column N is populated using: =SUMIFS(C$4:C4,D$4:D4,D4,E$4:E4,E4)
    On the Sales sheet column P is populated using: =COUNTIFS(D$4:D4,D4,E$4:E4,E4)
    The Purchase Date column, which is in column Q for comparison, is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Thank you so much Jete!
    Really appreciate it..

  9. #9
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jete,

    If you don't mind could explain me about the formula :
    =INDEX(Purchase!A$4:A$58,AGGREGATE(15,6,(ROW(Purchase!A$4:A$58)-ROW(Purchase!A$3))/(Purchase!D$4:D$58=D4)/(Purchase!E$4:E$58=E4)/(Purchase!N$4:N$57>=P4),1))

    Because I really don't get it.
    Thank you.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    I am going to ask you to first view the way the formula works using the Evaluate Formula feature found on the Formulas tab.
    Afterwards, if there are elements of the formula that are still not clear then I'll attempt to explain those elements.

  11. #11
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jete,

    I still don't understand.
    Kindly explain.
    Thank you.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    INDEX(Purchase!A$4:A$58 means that the formula will return values from the range A4:A58 on the Purchase sheet.
    AGGREGATE(15,6, means that the results will be from the smallest row number of the range, ignoring errors
    (ROW(Purchase!A$4:A$58)-ROW(Purchase!A$3)) produces an array of numbers from 1 to 55
    (Purchase!D$4:D$58=D4) includes only the rows that have the same item
    (Purchase!E$4:E$58=E4) includes only the rows that have the same color
    (Purchase!N$4:N$57>=P4) includes only the rows that have a greater cumulative value than that in column P on the Sales sheet
    1 means that the formula will only take the smallest of the remaining numbers and find that row out of the range Purchase!A$4:A$58 i.e. row 2 in the range would be cell A5.
    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    automatic date formula

    Thank you.
    Last edited by ririn0105; 11-03-2023 at 01:06 AM. Reason: want to delete the question

  14. #14
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jate,

    Kindly help me to make a formula on column : Balance from Purchase Sheet

    Because if I use my current formulas, they don't cover all the parameter to run, so sometimes the result didn't show as I want.
    Thank you so much.
    Last edited by ririn0105; 11-03-2023 at 01:08 AM.

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    Please tell us which results in the Balance column are incorrect and what the correct results should be.
    Also, unless it is very obvious, tell us how at least one of the correct results would be manually calculated.

  16. #16
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Herewith I attach the file again.
    On purchase date column last row the balance should be 2 not -2.
    Hope you understand what I mean.
    Thank you.
    Attached Files Attached Files

  17. #17
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    I don't understand.
    According to the highlighted areas, 4 of the Beige Eiger X-Cruisage Canvas 20L Laptop Backpacks were purchased from shopee on Nov. 1 and then 3 of those were sold on Nov. 3.
    It seems as if the balance should be 1.

  18. #18
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    No Jete on 1st nov 3 were purchased from Shopee, 1 from lazada, and then 1 from shopee again (diferent price).
    So I bought 5 bags on that date.
    On sales data sheet, 4 were sold on 3rd Nov (just simulation)
    On balance column the last row should show 1, not -2 (it calculate from the same date, 1st november 1-3 = -2)
    My current formula can't cover all the parameter so the result is -2, because I don't use cummulative.
    Hope you understand.
    Thank you.

  19. #19
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    Thank You for the explanation.
    Please paste the following into cell L4 and then copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  20. #20
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jete,

    I think the formula is not correct because the balance :
    1-Nov-23 Shopee 3 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 5
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 5
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 5

    The balance shows 5 bags if there's no selling.
    It sums 3+1+1.

    The result shoud be :
    1-Nov-23 Shopee 3 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 3
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 1
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 1

    Thank you.

  21. #21
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    It seems to me that the three purchased in row 59 should be added to the one purchased in row 61 to yield a total of four, if none are sold.
    Here is a formula that will yield those amounts:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  22. #22
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Dear Jete,

    If I copy the formula the result still not the result I want
    The balance result :
    1-Nov-23 Shopee 3 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 3
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 4
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 5

    I want the balance if none are sold :
    1-Nov-23 Shopee 3 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 3
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 1
    1-Nov-23 Shopee 1 Eiger X-Cruisage Canvas 20L Laptop Backpack Beige 1

    Because in Balance Total I want the value of Balance * Unit Price, since the price is not the same from every purchase.
    Hope you understand.
    Thank you.

  23. #23
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    I feel that cells H67:H69 on the Sales sheet will need to be filled for this to work:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    08-31-2023
    Location
    Indonesia
    MS-Off Ver
    365
    Posts
    14

    Re: Automatic date formula

    Thanks Jete.. solved!

    But I modified a little bit to :

    =IF(E4="-";"-";IF(SUMIFS(C$4:C4;A$4:A4;A4;B$4:B4;B4;D$4:D4;D4;E$4:E4;E4;G$4:G4;G4)-COUNTIFS(Sales!G$4:G$79;B4;Sales!$D$4:$D$79;Purchase!D4;Sales!$E$4:$E$79;Purchase!E4;Sales!$F$4:$F$79;Purchase!A4;Sales!H$4:H$79;Purchase!G4)=0;"sold";SUMIFS(C$4:C4;A$4:A4;A4;B$4:B4;B4;D$4:D4;D4;E$4:E4;E4;G$4:G4;G4)-COUNTIFS(Sales!G$4:G$79;B4;Sales!$D$4:$D$79;Purchase!D4;Sales!$E$4:$E$79;Purchase!E4;Sales!$F$4:$F$79;Purchase!A4;Sales!H$4:H$79;Purchase!G4)))

    because I want if the result is "0" = "sold"

    Thanks.

  25. #25
    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,990

    Re: Automatic date formula

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

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    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.

  26. #26
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,576

    Re: Automatic date formula

    You're Welcome and thank you for the feedback. As Ali stated, please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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. [SOLVED] Excel Formula - Automatic Date Calculation
    By marmar89 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2019, 05:53 AM
  2. Formula for automatic date update?
    By Rpatel1974 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-22-2014, 12:02 PM
  3. Due Date: Automatic Input using formula or function
    By DianaEve in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-15-2013, 02:22 PM
  4. [SOLVED] sumif formula automatic date change criteria
    By sonor_nut in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-17-2013, 08:45 AM
  5. Excel formula for color change and automatic Date Changes
    By ashhm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2012, 11:07 AM
  6. Automatic Number & Date Sorting Formula
    By haan in forum Excel General
    Replies: 16
    Last Post: 01-11-2011, 03:17 PM
  7. Formula for Automatic Day Calculation against any date
    By leo73pk in forum Excel General
    Replies: 2
    Last Post: 11-01-2006, 03:28 PM

Tags for this Thread

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