I am in need of a macro to select the value based on two columns

value.

Below is the sample spreadsheet where my datas are arranged:

Column A Column B Column C

(City) (County)

(Factor)

ABBEVILLE HENRY 06

ABBEVILLE FD HENRY 06

ABERNANT CSA TUSCALOOSA 07

ABERNATHY CSA CLEBURNE 09

ADAMSBURG CSA DEKALB 05

ADAMSBURG CSA CHEROKEE 10

ADAMSVILLE JEFFERSON 01

ADDISON WINSTON 06

ADDISON FD WINSTON 06

ALTOONA ETOWAH 01

ALTOONA BLOUNT 07

For eg, for city "ALTOONA" and county "BLOUNT", the factor value

should return as "07". The factor value should return based on the

match of both A and B cell value.

Please help me by posting the macro for above scenario.

Thanks,

Maniarasan

Not really sure that this is what you are looking for:

I've implemented a function to return the value in column C if a match

is found in columns A & B.

Note that only the first match is returned - based on your post I assume

that the matches in A & B are always unique.

Call the Function with

=Factor("String to find in first Column", "String to find in 2nd

Column", Range to search in First Column)

If there is no match zero is returned.

Function Factor(A As String, B As String, C As Range) As Variant

Dim D As Range

Application.Volatile True

For Each D In C

If D.Value = A Then

If D.Offset(0, 1) = B Then

Factor = D.Offset(0, 2)

Exit Function

End If

Else

Factor = 0

End If

Next D

End Function

1. How do I match two cells and input a value in a different cell?

2. How can I use values in two separate cells to select a new cell?

3. Inputting cell value from source cell based on value in adjacent cell.

4. IF value in a cell, return another cell's value to original cell

5. How to make a cell value generate a cell value in another cell

6. Select max value from 9 cells, copy cell col heading to other cell

7. NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND C

8. Return Values in Same Row, Different Column That Match Cell Value

9. matching values and inputing value in the adjacent cell

10. if cell value matches then copy another cell

11. Top cell in a list to match cells below of a certain value?

12. Return Values in Same Row, Different Column That Match Cell Value

13. Help finding Row ID of Row where value in cell matches a value

14. match value in cell to a value in a range

15. Find a cell that matches the value of another cell

2 post • Page:**1** of **1**