Forum Discussion
danielle1962
Feb 21, 2022Copper Contributor
if function
I am a fairly new excel user and on my spread sheet I am wanting it to put a mileage number in a column if the name of the business in another column is something. I am doing a spread sheet where i ...
OliverScheurich
Feb 21, 2022Gold Contributor
With IF formula you can apply this formula in the attached example:
=IF(A2="Home Depot",2,IF(A2="Away Depot",3,IF(A2="Home Port",4,"")))If you work with Office365 or 2021 you can use IFS or XLOOKUP as well.
In the attached file there is this formula in cell C2 copied down to C4:
=VLOOKUP(A2,$G$2:$H$4,2,FALSE)And there is this formula in cell D2 copied down to D4:
=INDEX($H$2:$H$4,MATCH(A2,$G$2:$G$4,0))Both formulas work with the help of the data in range G2:H4.