FIND fuction in a cell formula

dschroeder

New Member
Joined
Nov 21, 2011
Messages
6
Is it possible to create a cell formula in Excel to reproduce the following macro? The items to find are account numbers and then the offset selects the dollar value for the found accounts. Thanks for any help-David

Windows("data file.xlsx").Activate
Columns("C:C").Select
Selection.Find(What:="21823", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 2).Select
A = ActiveCell

Windows("data file.xlsx").Activate
Columns("C:C").Select
Selection.Find(What:="21825", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 2).Select
B = ActiveCell


Range("E1") = A + B
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Since your OFFSET is looking at column E, you probably don't want to put the formula within column E. If you really, really do want to put it in E1, adjust the formulas below to be a range rather than full columns, e.g. C2:C.. and E2:E..

=INDEX(E:E,MATCH("*21823*",C:C,0))+INDEX(E:E,MATCH("*21824*",C:C,0))

This assumes the data in column C is text, not numeric. (I assumed this because you're looking for a partial match in the VBA code (xlPart).
 
Upvote 0

Forum statistics

Threads
1,215,198
Messages
6,123,593
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top