Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with creating a formula...

I have several worksheets that are in one workbook. One of the worksheets is
updated daily (We will enter in our foremen's initials if they are working).
I want Microsoft Excel to recognize when one of our foremen is not working.
I have created a list of the foremens names and the initials that are used.
I want Excel to see if the initials are in Column D. If they are NOT, I want
them to drop the initials AND name into column M. This is an effort to have
our information more readily available and accurate. Any help, would be
AWESOME!

I could send the file so that you know exactly what I mean...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with creating a formula...

Ok Meleah

I don't know how advanced your Excel is (form point of view of creating
names, formulae, adding modules etc...)

but here is some code that will do the trick, it's hard to do in a formula,
because a formula can tell against a whole list of names who is and who isn't
there, but it can't just show (in any way I know) only the people who are not
there...


Sub CheckNames()

Dim rngAllForemen As Excel.Range
'where all the foremen are named
Set rngAllForemen = Range("AllForemen")

Dim rngWorking As Excel.Range
Dim rngNotWorking As Excel.Range
Dim rngLoop As Excel.Range
Dim vntIsThere As Variant
Dim intI As Integer
'where the working ones are named
Set rngWorking = Range("B5").CurrentRegion
'you always need to do this...
Range("M5").CurrentRegion.Clear
Set rngNotWorking = Range("M5").CurrentRegion


'where the non-working ones are named



'always clear non-working ones first


For Each rngLoop In rngAllForemen
If Not IsNameInList(CStr(rngLoop.Value), rngWorking.Cells) Then
'an error means it wasn't there i.e match couldn't find it
rngNotWorking.Cells(intI, 1).Value = rngLoop
intI = intI + 1
End If
Next

End Sub


Function IsNameInList(strName As String, rngToSearch As Excel.Range) As
Boolean
Dim blnRetVal As Boolean
blnRetVal = False
Dim rngLoop As Excel.Range
For Each rngLoop In rngToSearch.Cells
If rngLoop.Value = strName Then
blnRetVal = True
Exit For
End If
Next

IsNameInList = blnRetVal


End Function





Assumptions Made:
that you create a reference list of the entire list of foremen and name it
"AllForemen"

That you start in B5 your first list of entries of foremen who are working
on that day

that the names of foremen (and or initials) are all in one cell


that you report the non-working formen starting from cell "M5"

that you don't have any columns either side of B or M as the currentregion
property the way it is used in the macro will wipe them out

that you hook up that code into a module and onto a button on the sheet
to do that you show the 'forms' toolbar (after you've pasted that code into
a module)
you drag a button onto the worksheet, Excel will prompt you with the 'assign
macro' dialog, and you choose 'CheckNames' as the macro for the button


in case of any doubt try this out on a copy of your data...not on the
original! please!
I don't want you to lose any data (remember undo is not straighforward to
implement in a macro), but also bear in mind the only thing that gets cleared
is the 'non-working' foremen list...


if you find this a bit too complicated, pls ignore and wait for a smarter
and more appropriate post :-)


Regards
CharlesA
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a formula Karsea Excel Worksheet Functions 2 February 9th 09 05:09 PM
formula creating referrrrrr Excel Discussion (Misc queries) 1 June 12th 06 06:08 PM
Help with creating a formula jaysphotos Excel Programming 3 December 2nd 05 10:23 AM
Creating a formula Kimi Excel Worksheet Functions 3 April 8th 05 04:37 AM
Help with creating Formula again Benny Excel Worksheet Functions 13 March 20th 05 04:59 PM


All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"