+ Reply to Thread
Results 1 to 14 of 14

Array formula to pull multiple numbers based on test

  1. #1
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Array formula to pull multiple numbers based on test

    Hi all,

    I have a payroll tracking workbook that has been very useful until now. The workbook consists of entry sheets (for entering # of hours and OT codes) and reporting sheets (to pull the # of hours from the entry sheet and instert into the correct column).
    So far, so good. Problem is, I have run up against an unforseen issue - occassionally, an employee may require the entry of 2 different codes on the same day. The current formula cannot make that allowance and therefore misses 1 of the codes 9actually gets confused and pulls the wrong numer for 1 code and ignores the other completely). Regretfully, this is beyond my abilities.

    Here is the current formula:

    =SUM(IF(ISNUMBER(FIND(" "&Q$3&" "," "&'sheet1'!$AS61:$BF61&" ")),LEFT('sheet1'!$AS61:$BF61,FIND(" ",'sheet1'!$AS61:$BF61)-1)+0))+SUM(IF(ISNUMBER(FIND(" "&Q$3&" "&"P23"&" "," "&'sheet1'!$AE61:$AR61&" ")),LEFT('sheet1'!$AE61:$AR61,FIND(" ",'sheet1'!$AE61:$AR61)-1)+0))

    *The second part of the formula (after the '+' - in blue) is just a copy of the first, giving the command to look back for the code for 'late entries' (P#)

    Workbook attached - any help would be greatly appreciated! Getting desperate here
    Attached Files Attached Files
    Last edited by Greed; 11-24-2011 at 03:05 PM. Reason: Solved

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

    Re: Array formula to pull multiple numbers based on test

    Try, in G10:

    Please Login or Register  to view this content.
    Confirmed with CTRL+SHIFT+ENTER. copied to other directions.

    This formula assumes that the numbers for each code entered will always be 1 or 2 digits only..
    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
    Registered User
    Join Date
    11-24-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Array formula to pull multiple numbers based on test

    I have seen the worksheet, do you want to pull both 14 and 6 in different cell? if yes then where do you want those values to reflect. Please use first few rows with you current data and then show the example the way you want your output. It makes us very clear to work on it.

  4. #4
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    Yes NBVC, that appears to do the trick...even works on 3 different codes that I tried in the same cell! Ahhhh, to be such an Excel Pro - I aspire to be you

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

    Re: Array formula to pull multiple numbers based on test

    From PM:

    Hi - sorry to bother you, but I have just discovered that the formula isn't catchin numbers with a decimal - anything you can tweak in here for that? TIA

    Please Login or Register  to view this content.
    How many decimals? Can you give another spreadsheet sampling?
    Last edited by NBVC; 11-25-2011 at 12:55 PM.

  6. #6
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    I have attached an updated version of the spreadsheet including codes with decimals - updated with the code you provided. There could be up to 2 decimal places, eg. 1.75 (hours) - thanks
    Attached Files Attached Files

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

    Re: Array formula to pull multiple numbers based on test

    Does this in D10 work?

    Please Login or Register  to view this content.
    copied to other cells..

  8. #8
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    Yes, this seems to work - assuming I use [alt]+[enter] before entering a second or third code in the entery cell?
    If I may impose on you once more...with my previous formula, I was able to alter it somewhat to tack the same (but slightly altered) formula onto the end - but with the addition of the search term of a particular pay period (eg. P21) - to tell it to look at the entire entry grid for any 'late' entries. If a code had "P21" on the end, the formula would pull entries in any pay periods that referenced the current pay period (being P21). My formula used to look something like what I have in the *newly* updated spreadsheet - It gets confused by the 2nd code entered in the same cell and cannot pull just the codes with "P21", it pulls everything...TIA if you can help...it's gotten so complicated I don't know how to tweak it
    Attached Files Attached Files

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

    Re: Array formula to pull multiple numbers based on test

    I am not understanding the P21 add on. So it's supposed to count the number of P21 that appear in the whole row and add to the original formula?

    btw, this formula in G4:

    Please Login or Register  to view this content.
    CSE confirmed... should now allow for codes separated with a space or with ALT+ENTER carriage return.

    If you did want to count and add to the above formula, then:

    Please Login or Register  to view this content.
    You can change the P21 to "*"&$A$1&"*" where A1 has current payperiod (P21) in it... so that you can have a more dynamic formula.
    Last edited by NBVC; 11-25-2011 at 03:07 PM.

  10. #10
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    That's great for catching all of the 'typical' entries, but not for the 'late' entries (indicated by the "P#" at the end).... I changed the COUNTIF to SUMIF as I need to sum the hours from any past pay periods (ie. has the "P21" on the end") with the current pay period hours, but it's not finding them (P21 entreis) that way - if I use the COUNTIF as is, it counts the number of cells with "P21" but shows it across all columns - I need to tell it to only look for the code in row 3 (like the 1st part of the formula), but only pull the number if it has "P21" on the end....like the dynamic option for that also! - TIA

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

    Re: Array formula to pull multiple numbers based on test

    Ok, I think I understand... I think

    Try, in C4:

    Please Login or Register  to view this content.
    CSE confirmed and copied down and across.

  12. #12
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    WOW! By jove you've got it! I really must know - how much schooling does it actually take to get to where you are? I want to be there, but I don't even know how/where to start...and really, thanks a lot - you guys (or gals? It would be cool if there were awesome Excel chicks too - like I hope to be one day...) do us peons such a huge service! We are forever in your debt.

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

    Re: Array formula to pull multiple numbers based on test

    No formal schooling.. just picked everything up being on these forums

    Teylyn is our "Excel chick" here

  14. #14
    Forum Contributor
    Join Date
    07-15-2011
    Location
    Whitby, Canada
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Array formula to pull multiple numbers based on test

    Excellent - I guess I'll just keep it up then ~ sigh

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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