Pencil pushing Excel gurus, please enter

blakbearddelite

I'm not one of your 'shit-hole' buddies!
TCG Premium
Jun 28, 2007
29,253
9,083
FL
ok i got it to work. i was right on the search wanting a single value, the thing is the match goes through the list and does the search on every individual value. then you get an index if it's found and the other shit uses that as a lookup to put in your output value.

it will probably get slower if you have a large list, but hey, shit's probably fast enough for what you are doing. also it looks like if you put an object in the list twice, it simply uses the first value.

if you wanted a more dynamic string pattern matching thing, you could probably write your own little excel function with vb.

here's the key part you are missing:
This is an array formula and must be entered with Control + Shift + Enter.

I'm not sure I get the array formula thing and how it must be entered with Control + Shift + Enter.

Where might I find a decent tutorial on vb? Is that Visual Basic?
 

Intel

TCG Elite Member
Oct 28, 2009
5,889
3,357
Palatine
Except that I will have probably anywhere between 40-50 items that I will want to look for, not just cells that contain "PAYROLL".

I am a bit rusty with excel but I helped a friend with something similar to this.

VLOOKUP is your friend for this.

=VLOOKUP(C2,C5:D17,2,TRUE)

This formula says to look for the value in C2 in the range C5:C17. If the value is found, then return the corresponding value from the same row in column D.

https://support.office.com/en-us/ar...pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8
 

Chet Donnelly

TCG Elite Member
TCG Premium
Aug 19, 2004
18,445
39,124
I believe some companies might try and hide some upside if they're having a good month. They may dump something into a balance sheet account for a rainy day.

All companies do that for sure, along with hiding downsides! The automakers overbuild inventory to play absorption accounting games, and then will shut down production for a month or two come January. Kills working capital, but can boost your income.
 

blakbearddelite

I'm not one of your 'shit-hole' buddies!
TCG Premium
Jun 28, 2007
29,253
9,083
FL
I am a bit rusty with excel but I helped a friend with something similar to this.

VLOOKUP is your friend for this.

=VLOOKUP(C2,C5:D17,2,TRUE)

This formula says to look for the value in C2 in the range C5:C17. If the value is found, then return the corresponding value from the same row in column D.

https://support.office.com/en-us/ar...pitfalls-0b22ff44-f149-44ba-aeb5-4ef99da241c8

The problem is that it needs to use the 'contains' functionality. The data has other information in it that changes each month, banking information. One month it could be COMPANY ABC 234434534 and the next month is might be COMPANY ABC 4234854834. It needs to be smart enough to know that they're the same thing. A vlookup won't do that.
 

sickmint79

I Drink Your Milkshake
Mar 2, 2008
27,079
16,897
grayslake
I'm not sure I get the array formula thing and how it must be entered with Control + Shift + Enter.

Where might I find a decent tutorial on vb? Is that Visual Basic?

go into your original cell, put the cursor at the end (take out those { }) and hold ctr and shift then press enter. now it will tell it to act on every cell in a range and work as expected.

kinda clever and didn't know that was a feature you could do.

if your spreadsheet isn't working after you do that, if you replicated this exactly, the most likely next failure point would be not labeling the cells as denoted (the things and results denoted in the bottom right of the image)
 

sickmint79

I Drink Your Milkshake
Mar 2, 2008
27,079
16,897
grayslake
I'm not sure I get the array formula thing and how it must be entered with Control + Shift + Enter.

Where might I find a decent tutorial on vb? Is that Visual Basic?

and yes vb is visual basic. here's an example of one i hacked out from a significant figures function i didn't exactly like because it wasn't dealing with some data i was receiving.

open a new excel file, hit alt + f11, congrats yer in vb macro mode. now you can hack the planet.

paste this in

Code:
Function SigFigsMike(rng As Range, Optional iType As Integer = 1)
    'iType = 1 is Precision
    'iType = 2 is Scale

    Dim rCell As Range
    Dim sText As String
    Dim sText2 As String
    Dim iMax As Integer
    Dim iLeft As Integer
    Dim iStart As Integer
    Dim iPrecision As Integer
    Dim iScale As Integer
    Dim i As Integer
    Dim iDebug As String

    Application.Volatile
    Set rCell = rng.Cells(1)

    'if not a number then error
    'commented out this was breaking on 0.0
    'If Not IsNumeric(rCell) Or IsDate(rCell) Then
    '    SigFigsMike = CVErr(xlErrNum)
    '    Exit Function
    'End If
    

    
    sText2 = Trim(rCell.Text)
    sText = ""
    'find position of decimal point (it matters)
    iDec = InStr(sText2, ".")
    

        
    If Val(sText2) = 0 Then
        iLeft = 1
        iScale = 0
    
    'do this if it's an integer
    ElseIf iDec = 0 Then
        iLeft = Len(sText2)
        iScale = 0
        
    'do this if it's a numeric
    Else
            
        'GET NUMBERS TO LEFT OF DEC
        If iDec = 2 Then
            iLeft = 1
        Else
            iStart = 0
            If Mid(sText2, 1, 1) = "-" Then
                iStart = 1
            End If
        
            iLeft = iDec - iStart - 1
            
        End If
  
        'GET NUMBERS TO THE RIGHT
        sText = Mid(sText2, iDec + 1)
    
    
        'strip trailing zeroes
        While Right(sText, 1) = "0"
            sText = Left(sText, Len(sText) - 1)
        Wend
        
        iScale = Len(sText)

    End If

    iPrecision = iLeft + iScale

    'return Min or Max
    Select Case iType
        Case 1
            SigFigsMike = iPrecision
        Case 2
            SigFigsMike = iScale
        Case Else
            SigFigsMike = CVErr(xlErrNum)
    End Select
End Function

then just close the window. now you have the SigFigsMike function written in vb. it takes a cell as input, then a 1 to have it return precision, or a 2 for scale.

so go into A1 and put in the value 1300.03
in B1 put =SigFigsMike(A1, 1) and in C1 put =SigFigsMike(A1, 2)

you should see the values 6 and 2, which means to store this data in a database, the field would need to be declared as numeric(6, 2) to actually store it.

it's a little weird, like it seems to care how the format of the number is displayed, ie. 1300.0300005 won't be exactly right until you make the input cell an actual number out to x places and refresh the formula, but whatever, good enough for how little i need it.

you could basically make a vb that has a case statement and a bunch of string pattern matching in it, or even much more complicated logic. ie. if string like this, but not like that, and amount is greater than whatever, then use this value, etc.
 

Blownbyyou

TCG Elite Member
TCG Premium
Mar 27, 2008
3,899
4,023
My biggest issue we have is that some of the bill of materials we receive here are like 900 lines long in excel, and some of the lines are the same part number and we try to count the amount of lines for each part number to get a final tally and its a pain in the ass.

My main goal would be to use a formula in that row that would let me know that there's 200 of part A, 210 of part B, 38 of part C, etc...

Anyone know if that's possible?



Send me the data, seems wicked easy
 

CMNTMXR57

GM, Holden & Chrysler Mini-Van nut swinger
TCG Premium
Sep 12, 2008
26,485
31,985
Elgin
The nesting issue with the isnumber is where it can sometimes get funky.

I was doing it on my own, using the example, got it to work, then my system had an auto-software update and blew everything out and rebooted and I wasn't about to go redo it.
 

CMNTMXR57

GM, Holden & Chrysler Mini-Van nut swinger
TCG Premium
Sep 12, 2008
26,485
31,985
Elgin
Pivot tables are your friend

For quick data summarization, yes.

For reference to other dependents (formulas in other tabs/worksheets/etc), they can be more a PITA than they're worth.

I use Pivot tables a lot for sales information (Unshipped sales), that I track, summarizing them by division. But outside of that, I wouldn't link to that table because god forbid the next time I refresh with updated data, and a division either gets added or deleted in the data, and it fucks up the linked to formula.
 

sickmint79

I Drink Your Milkshake
Mar 2, 2008
27,079
16,897
grayslake
I must be losing it. At my last job, with my Excel, I was able to split Excel files. One on one screen, and then one on the other. Now I'm not able to do that. I won't let me slide over a second Excel file onto my other monitor. What gives?

i guess if you made a huge window you could put 2 within that same instances in it and control how much space they took up, maybe more likely is that you have 1 instance of excel open and you are looking at multiple files in it, while you actually want a 2nd instance of excel open? if that's the case, just navigate to start menu -> excel and it should load up a new instance with no files. do a file -> open from it, and now you have a totally independent instance from the other one, throw it on one screen and maximize it and do the same with the other. is that what you're looking for?

also get dis mouse http://www.thechicagogarage.com/forum/entertainment-tech/161073-hey-nerds-buy-mouse.html
 

Bruce Jibboo

TCG Elite Member
Apr 18, 2008
19,791
155
Elgin
I'm 99% you're an accountant/finance guy too. I'm using this on an export from our bank transactions. Currently, I have to manually code each withdrawal based on the description. I was hoping to use this to automate that process. For example, the description contains the text "PAYROLL", return "5164". 5164 is where we book our production salary/wages.

There are hundreds of line items each month that have to be manually coded. And many of these wire/payments repeat each month. So I was going to set up an index match.

Yes, I realize manually coding stuff is old school, but this legacy system is a huge piece of shit and does not generate any journal entries. We're moving towards an ERP in the next year that will make this task obsolete.

TLDR; but do know what your talking about /wink

https://www.youtube.com/watch?v=GyB6ffmXsZo
 

Bruce Jibboo

TCG Elite Member
Apr 18, 2008
19,791
155
Elgin
i guess if you made a huge window you could put 2 within that same instances in it and control how much space they took up, maybe more likely is that you have 1 instance of excel open and you are looking at multiple files in it, while you actually want a 2nd instance of excel open? if that's the case, just navigate to start menu -> excel and it should load up a new instance with no files. do a file -> open from it, and now you have a totally independent instance from the other one, throw it on one screen and maximize it and do the same with the other. is that what you're looking for?

also get dis mouse http://www.thechicagogarage.com/forum/entertainment-tech/161073-hey-nerds-buy-mouse.html

this mouse hype better be worth it lol

its being compared to the G502 I have now.
 
Old Thread: Hello . There have been no replies in this thread for 90 days.
Content in this thread may no longer be relevant. Consider starting a new thread to get fresh replies.

Thread Info