Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bud Bud is offline
external usenet poster
 
Posts: 61
Default Numbers are text and won't match using a formula

Hello

Cells(2, "b") = "=SAPTasks!A2" 'SAP Personnel....This formula moves the
personnel number fro the SAPTasks worksheet into another worksheet containing
the formula.
Cells(2, "b").AutoFill Destination:=Range(Cells(2, "b"), Cells(br,
"b"))...this formula than fills that formula down a number of rows that is
contained in the field br
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"...this
formula gets the name of the person from the worksheet personnel by matching.

The issue is the personnel number from the SAPTasks worksheet is TEXT so it
isn't finding the match.

I just want to be able to find the name.

Excel suggested multiplying by 1 in the field containing the number(Text). I
recorded a macro that works and gives teh following but it goes 65536 or
something.

How can I do the following code better so it converts the number to a number
and allows the matching on a designated number of rows in br??????
Columns("A:A").Select
Selection.Copy
Columns("Q:Q").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("R1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "1"
Range("R1").Select
Application.CommandBars("Task Pane").Visible = False
Range("R1").Select
Selection.Copy
Columns("Q:Q").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Columns("Q:Q").Select
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Numbers are text and won't match using a formula

Hi Bud,

Try the following. See comments for what it is doing. Not the way the
purists would do it but i think that it might be easier for you to understand.

Sub Macro1()
'Ensure that column A is formated to numeric
Columns("A:A").Select
Selection.NumberFormat = "0"

'Select and enter 1 in an empty cell
Range("R1").Select
ActiveCell.FormulaR1C1 = "1"

'Copy the cell
Selection.Copy

'Select from first cell to last used cell in column A
'Identifying last used cell is like selecting the
'last cell in column A (65536 or something.)
'Holding the Ctrl key and pressing up arrow to
'find last used cell in the column.
Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp)).Select

'Paste Special multiply
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
End Sub


--
Regards,

OssieMac


"Bud" wrote:

Hello

Cells(2, "b") = "=SAPTasks!A2" 'SAP Personnel....This formula moves the
personnel number fro the SAPTasks worksheet into another worksheet containing
the formula.
Cells(2, "b").AutoFill Destination:=Range(Cells(2, "b"), Cells(br,
"b"))...this formula than fills that formula down a number of rows that is
contained in the field br
Cells(2, "k") =
"=IF($b$2:$b$8000="""","""",(INDEX(Personnel!$B$1: $B$1000,MATCH($b$2:$b$8000,Personnel!$A$1:$A$1000, 0))))"...this
formula gets the name of the person from the worksheet personnel by matching.

The issue is the personnel number from the SAPTasks worksheet is TEXT so it
isn't finding the match.

I just want to be able to find the name.

Excel suggested multiplying by 1 in the field containing the number(Text). I
recorded a macro that works and gives teh following but it goes 65536 or
something.

How can I do the following code better so it converts the number to a number
and allows the matching on a designated number of rows in br??????
Columns("A:A").Select
Selection.Copy
Columns("Q:Q").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("R1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "1"
Range("R1").Select
Application.CommandBars("Task Pane").Visible = False
Range("R1").Select
Selection.Copy
Columns("Q:Q").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Columns("Q:Q").Select
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False


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
MATCH search with text and numbers Patryk Excel Worksheet Functions 1 January 27th 10 08:26 PM
text match formula not working Belinda7237 Excel Worksheet Functions 2 January 23rd 09 04:47 PM
match function with text and numbers sugargenius Excel Programming 2 December 13th 06 01:38 PM
match cell text with text in formula Todd L. Excel Worksheet Functions 3 December 9th 04 08:11 PM
how to build a formula to match numbers in 2 columns with the equ. mcdilash Excel Worksheet Functions 1 November 10th 04 05:31 PM


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

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

About Us

"It's about Microsoft Excel"