+ Reply to Thread
Results 1 to 29 of 29

formula to calculate total amount of previous invoice

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    formula to calculate total amount of previous invoice

    good evening all
    kindly can help how can calculate previous total amount of invoice
    in my attached excel
    in cell P2 its contain project name that can i selected from drop list then column Q2 have list of invoiced issued for this project before (column I) ,matched with selection in cell P2

    result will be like in R2 for total amount of previous invoiced And S2 for current balance
    i make example result in different line in column P,Q,R,S to explain how calculation will be


    i hope my explanation is clear
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    Hi Mazan2010,
    how about this?
    R2 and down:
    =SUM(($A$2:$A$22=$P2)*($J$2:$J$22)*(RIGHT($Q2,1)>RIGHT($E$2:$E$22,1)))
    Attached Files Attached Files

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: formula to calculate total amount of previous invoice

    Please try at R2

    =SUMIFS($J$2:$J$22,$A$2:$A$22,P2,$E$2:$E$22,"<"&Q2)
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    please can check attached file as its not give correct value in my real file when apply

    both formula give me incorrect value, whats wrong
    Attached Files Attached Files

  5. #5
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    The data in your latest file gives no indication of how to differentiate current vs previous invoice. In the first file posted you had a column "LF no" and "Number" which were easily differentiated: none of this appears in the current file,

  6. #6
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    here in this attached file current invoice is in O2
    previous Invoice for the same project is in I15
    please see attached new file with correct value with green font color
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    i notice that with this formula its not differentiate between IAF1 and IAF10 , as IAF10 start as its first invoice like IAF1,

    how can apply exact match
    HTML Code: 

  8. #8
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    Hi
    Try this
    =SUM(($A$2:$A$22=$P2)*($J$2:$J$22)*(B2:B22 < VALUE(MID(O2,17,9))))
    Attached Files Attached Files

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: formula to calculate total amount of previous invoice

    Please try

    =SUMIFS($J$2:$J$50000,$A$2:$A$50000,$P$2,$B$2:$B$50000,"<"&-LOOKUP(0,-RIGHT(O2,{1,2,3})))

    or change F3 to have leading Zero

    =IF(A2="","",(A2&"-IAF"&TEXT(B2,"00")))
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: formula to calculate total amount of previous invoice

    Try this
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  11. #11
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    dear Bo_Ry
    please check attached file that not give any result with IFA100
    although its give with IFA99 & 101
    what you mean F3 lead zero
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    Dear belinda200
    its work well but i notice that when number of character in name changed (increased or decreased ) not give value
    for example
    in previous attached file the name was
    Lab-45123456 number of character using len function is 12
    but when name changed to
    Lab-4500016806 number of character is 14
    for formula i try to changed in part of mid as
    HTML Code: 
    as you can see i change 17 in original formula to 19
    my question how can make it dynamic , suitable for any number
    my name always consist of three part as the following
    LAB- this part will be fixed
    then text or number (variable ) this is mid text or number between two - sign
    then -IAF1 to ......... according to number of line of the same name
    if there is way to make last part of formula as after text LAB- and last - sign , i think it will be good

  13. #13
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    i try to modify mid part from original formula to the following
    1-
    HTML Code: 
    or
    2-
    HTML Code: 
    but its not work

  14. #14
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    If you need the value after IAF then

    =SUM(($A$2:$A$22=$P2)*($J$2:$J$22)*(B2:B22 < VALUE(MID(O2,FIND("IAF",O2)+3,9))))

  15. #15
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    As this appears to be solved can you please mark the thread as such: see "Thread Tools" at top of the first post. Thank you.

  16. #16
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    Quote Originally Posted by mazan2010 View Post
    Dear belinda200
    its work well but i notice that when number of character in name changed (increased or decreased ) not give value
    Hi
    Try this:
    =SUM(($A$2:$A$22=$P2)*($J$2:$J$22)*(B2:B22 < VALUE(MID(O2,SEARCH("IAF",O2)+3,9))))
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    Dear JohnTopley
    column for amount its get result from other sheet with the following formula
    HTML Code: 
    when i apply your formula its give error
    but when i remove formula from empty row its give result , please how can i solve it
    i try to solve it by using filter formula
    if there is way to fix your formula without filter

  18. #18
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    its work also but without formula
    HTML Code: 
    in empty row
    but if this empty row have this above formula its give error

  19. #19
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    I have no idea what you are referring to so please post a file.

  20. #20
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    please see attached file with cell Q2 and R1
    i try to add SUMIF to ignore cell have formula but empty , but its not work for me
    Attached Files Attached Files
    Last edited by mazan2010; 07-02-2021 at 06:50 AM.

  21. #21
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    Hi
    Delete the formulas in all columns from line 17 and down. This causes the error.

  22. #22
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    yes i already make it in attached file as in cell Q3 and R2


    but its database so i need to keep this formula in range of j2:J50000

  23. #23
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    The problem is having null("") in column J which result in "Value" errors.

    I recommend you learn how to use the "Evaluate Formula" function under "Formulas"

    try this

    =SUMPRODUCT(($J$2:$J$2000),($A$2:$A$2000=$P2)*($B$2:$B$2000 < VALUE(MID(O2,FIND("IAF",O2)+3,9))))

  24. #24
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    You can change your formula in column J to :
    =IFERROR(VLOOKUP(H2,Database!B1:C22,2,FALSE),0)

    instead of using the quotes, use "0", for the IFERROR part in your function.

  25. #25
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    also adjust column K to :
    =FILTER(J2:J34,J2:J34<>0)

    use 0 instead of quotes.

  26. #26
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    The SUMPRODUCT will work with the NULL condition plus does not require an array entry!

  27. #27
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365
    Posts
    3,187

    Re: formula to calculate total amount of previous invoice

    Quote Originally Posted by JohnTopley View Post
    The SUMPRODUCT will work with the NULL condition plus does not require an array entry!
    you are right . just one comment - in Office 365 you dont have array CSE formulas, it becomes dynamic array instead.

  28. #28
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: formula to calculate total amount of previous invoice

    thank you all for your help and support

  29. #29
    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
    30,908

    Re: formula to calculate total amount of previous invoice

    If you are now happy that all problems have been addressed please mark as SOLVED using "Thread Tools" at top of first post.

    Thank you.

+ 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] How to calculate Sales Tax and Service charge from an invoice total without a subtotal
    By marks9172 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-15-2024, 04:23 PM
  2. Formula needed to calculate this months total with previous data
    By pcgs in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-09-2019, 02:50 AM
  3. Replies: 5
    Last Post: 12-08-2016, 04:24 AM
  4. [SOLVED] Combine like invoice items into total amount
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2013, 11:19 PM
  5. [SOLVED] Formula to auto calculate total amount at the last row of the day
    By Jeffrey Ting in forum Excel General
    Replies: 7
    Last Post: 07-15-2012, 11:42 PM
  6. Replies: 2
    Last Post: 04-06-2008, 07:04 PM
  7. How do I calculate Amount of Sales Tax from Total Amount?
    By MikeS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2005, 04:06 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