Ok I want to look at a cell with a number in it and compare it to another cell with a number in it and if the cells are the same numbers I want it to write a text and if it is not correct test the next cell...
If a1 = a2 then write " P.O. " otherwise if a1 = a3 then write "P.O. 2"
and continue this test till it finds the correct argument any help is appreciated!
To me, clowns aren't funny. In fact, they're kind of scary. I've wondered where this started and I think it goes back to the time I went to the circus, and a clown killed my dad.
this way will work and will probably be easier to understand but takes a lot of time to type out if you are comparing a really large number of rows.
you could try using vlookup or hlookup (vlookup if the data is in columns, hlookup if it's in rows) and it would require a lot less typing, but requires a bit more knowledge. if you are used to using databases then vlookup is kinda like a simple scalar query.
the 2nd to last argument you had has a "2". that will return the 2nd column in the range of cells you selected A2 - A500. Since that range is only one column you need a "1" in there instead.
usually a vlookup is used when you have at least two columns. the first column in the range acts as your index. that determines what row it is going to look at and try to find a match for. the 2nd to last argument tells it what column on that row to look at for the return value. for instance if you had A2 - B500, and you put a 2 in there it would find the matching value in column A, and then return the value that is in column B.
i can't think of any really good reason to use just one column, if you already know the value you want to look up, A23 in your case, then you would just use that value.