# if statement using index match

I need to look at the value in snapshot_day, if it matches L1, then return the datavalue of column1, else datevalue of column1 -1/

what is the correct syntax?

K

snapshot_day      Join1            ColumnL1 -       15-Nov
Results should be
11/15/2015      42323            42323
11/15/2015      42323            42323
11/15/2015      42323            42323
11/16/2015      42324            42323
11/16/2015      42324            42323
11/16/2015      42324            42323
11/17/2015      42325            42324
11/17/2015      42325            42324
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Remote Training and ProgrammingCommented:
am guessing
K = column 1
L = Join1
M = ColumnL1
N = column where you need the formula

``````=IF ( K1=L1, L1, M1)
``````
BI ANALYSTAuthor Commented:
K = kAREN
not column 1
BI ANALYSTAuthor Commented:
Also need to convert to the datevalue and do a dateadd -1
BI ANALYSTAuthor Commented:
I was trying to use Index Match and a IF statement

or something like this

=IF(\$H2=\$L\$1,DATEVALUE(\$H2),DATEVALUE(\$H2)-1)
Remote Training and ProgrammingCommented:
ok, thanks

and obviously, you have a header row ... so formula would be for row 2, not row 1 anyway!  What are the column letters for your example?
Remote Training and ProgrammingCommented:
> "Index Match and a IF statement"

perhaps I am misunderstanding what you want ... could you please explain a bit better -- and maybe attach an example?

thank you
BI ANALYSTAuthor Commented:
I am trying to look at the date in column1, if = L1(15-Nov), then return the same value as original value 11/15/2015(42323), else subtract the column1 date -1 if date = 11/16/2015 (42324) and return the value of (42323), then convert into a datevalue.

I am attempting to create a unique value by combining the revised datevalue with the another field called FC - results = "ABC42323" or "ABC42324".

Hope this helps.
Remote Training and ProgrammingCommented:
> "create a unique value "

aah, that explains why you were considering Index-Match since I see that sometimes you have more than one date.  Hang on, let me wrap my head around this :)
Analyst Assistant Commented:
Can you attach a sample workbook?
Remote Training and ProgrammingCommented:
question ... if all you are doing is trying to create a unique value, how about adding a number or letter to the end?
Remote Training and ProgrammingCommented:
I have looked at what you wrote, and tried to figure out what you want ... but I am with Norie on this ... could you please post a sample?

I know it is often hard to describe things -- if we can see what you are after, we can help you better

thank you
BI ANALYSTAuthor Commented:
here is my solution:  =IF(\$H2=\$L\$1,\$H2,(\$H2)-1)

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Remote Training and ProgrammingCommented:
happy you got it ~ and you're welcome, hope our comments helped you
Remote Training and ProgrammingCommented:
out of curiosity, though, you said that you wanted the value to be unique ... but if there are 3 dates, you obviously cannot simply subtract 1 to make it unique ...
BI ANALYSTAuthor Commented:
Found solution on my own - thanks for the assistance.

K
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.