+ Reply to Thread
Results 1 to 21 of 21

VLOOKUP to search text between dates

  1. #1
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Smile VLOOKUP to search text between dates

    I basically want to search certain text between certain dates and once the text is found, want to add all values of corresponding cells.

    Attached sheet has all the info on.

    This forum is luckily the place to ask these questions.


    Thanks for all the help NBVC....
    Attached Files Attached Files
    Last edited by mrcois; 06-10-2010 at 04:41 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    Something like:

    =SUMIFS(Sheet2!C1:C4,Sheet2!B1:B4,"Transaction Charge",Sheet2!A1:A4,">=20100508",Sheet2!A1:A4,"<=20100512")

    you can replace the criteria with cell references.

    e.g

    =SUMIFS(Sheet2!C1:C4,Sheet2!B1:B4,X1,Sheet2!A1:A4,">="&Y1,Sheet2!A1:A4,"<="&Z1)

    where X1, Y1 and Z1 hold the respective search criteria

    if you are going to drag the formula down, etc... make the ranges absolute... (i.e. add $ signs)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    First of all, thanks for helping.

    I have tried your formula but get the following error: #NAME?

    I have re-uploaded the sheet with some modifications.

    Please modify the formula and upload the sheet.

    Thanks...
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    Somehow the formula wasn't accepted the first time...

    I just hit F2 and hit Enter and it worked.

    But note, that in Sheet2, there are extra spaces after Transaction Charge in B1 and B3... please remove those spaces so that you get an accurate result.

  5. #5
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    I have tried pressing F2 and Enter again, still the error: #NAME?

    I have made it simple on the attached sheet, but still have the same error.

    Please see if my formulas are correct on this sheet?

    Thanks.
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    So are you working in 2003 or 2007?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    Try:

    =SUMPRODUCT(C1:C4,--(B1:B4="TRANSACTION CHARGE"),--(A1:A4>=20100508),--(A1:A4<=20100516))

  8. #8
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    I started using 2007, but would initially use it on 2003...

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    See my last post above for an alternative... the formula I initially gave was under the assumption your were using 2007... SUMIFS is only for 2007 and later versions.

  10. #10
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    Thanks, tried the new formula on the 2003 version and it works 100%.

    The only thing now is, how do I change it that the result of the tow negative numbers shows a positive number only?

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    That didn't make much sense??

    If you want not to show negative results and show 0 instead, then:

    =MAX(0,SUMPRODUCT(C1:C4,--(B1:B4="TRANSACTION CHARGE"),--(A1:A4>=20100508),--(A1:A4<=20100516)))

    if you want to add up only positive numbers, then

    =SUMPRODUCT(C1:C4,--(B1:B4="TRANSACTION CHARGE"),--(A1:A4>=20100508),--(A1:A4<=20100516),--(C1:C4>=0))

    Is it one of those?

  12. #12
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    I want to add the two negative numbers (-2.65 + -8.50) together which totals -11.15, but want to display a positive value eg. 11.15

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    so then:

    =ABS(SUMPRODUCT(C1:C4,--(B1:B4="TRANSACTION CHARGE"),--(A1:A4>=20100508),--(A1:A4<=20100516)))

    ??

  14. #14
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    Brilliant... It works 100%...

    How will this formula change if I had to use in a 2007 version?

  15. #15
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    Put the ABS() around the SUMIFS formula I gave you initially.

    Note:

    The formula as is, will also work in 2007.. so you don't have to change it if you do not want to.

  16. #16
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    Will you be able to help me with another post I have running?

    http://www.excelforum.com/excel-work...ng-format.html

  17. #17
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    Hi NBVC

    I have used the following formula:
    =ABS(SUMPRODUCT(C1:C4,--(B1:B4="TRANSACTION CHARGE"),--(A1:A4>=20100508),--(A1:A4<=20100516)))

    My question now is:
    How do I change this formula if I want to search for the "Closest" match to "Transaction Charge" as the above looks for the "Exact" match?

  18. #18
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    What do you mean by closest match to "Transaction Charge"

    What are the possibilities?

  19. #19
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    If I have "Transaction Charge 2154" and "Transaction Charge 5976", both with values of R345.89.

    I then want the formula to add all "Transaction Charge" values which will then equal R691.78

  20. #20
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: VLOOKUP to search text between dates

    Try:

    =ABS(SUMPRODUCT(C1:C4,--ISNUMBER(SEARCH("TRANSACTION CHARGE",B1:B4)),--(A1:A4>=20100508),--(A1:A4<=20100516)))

    this will cater to the cells in column B containing the string anywhere within the cells...

  21. #21
    Forum Contributor
    Join Date
    04-20-2010
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2016
    Posts
    151

    Re: VLOOKUP to search text between dates

    YOU the MAN....

    Thanks, just what I wanted...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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