+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : IF formulas: possible to use variables?

  1. #1
    Registered User
    Join Date
    08-03-2009
    Location
    At that one place
    MS-Off Ver
    Excel 2007
    Posts
    6

    IF formulas: possible to use variables?

    Hello wise excel masters!

    I had a formula issue I was wondering if anyone would be able to help me with. Long story cut to a medium one: the shop I work at is starting to do a group lottery thing. In total, there will be roughly 250 sets of 6 numbers that I want to compare to the actual winning number. What I'm trying to do is say: if lottery number 1 equals actual number 1, then x=x+1 then, in the end, I would want to have it check what x equals, and display a number depending on that value. I can figure out the IF conditions necessary, but I do not know how, or if it's possible, to use an x value to keep track of the total matching numbers. Any insight would be appreciated. And if this is possible - will the x value be specific to that cell? Or would it add from every cell, making the value be much higher than intended?

    Thank you ahead of time for any help
    -Tsuchi ^_^
    Last edited by romperstomper; 07-08-2011 at 05:29 PM. Reason: Mark solved

  2. #2
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: IF formulas: possible to use variables?

    Hi,

    How about using the COUNTIF function?

    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  3. #3
    Registered User
    Join Date
    08-03-2009
    Location
    At that one place
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: IF formulas: possible to use variables?

    That's an interesting function! The problem with that is the requirement of ranges. For example, the winning numbers would be in a2:f2, and the numbers we need to compare against in a6:f6. If I were to put =COUNTIF(a2:f2, a6f6) would it compare the respective cells and give me a total that match? I'm not at a computer that I can test this against right now

    Would I be able to use the IF condition in an equation? For example "=(IF(a2 = a6, 1, 0)) + (IF(b2 = b6, 1, 0))" - assuming both conditions are true, would that return a value of 2? Or would it simply slap me with an error?

  4. #4
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: IF formulas: possible to use variables?

    Maybe it would be best if you attached a sample spreadsheet so we can see what you're trying to describe.

    "A picture is worth a thousand words!"

  5. #5
    Registered User
    Join Date
    08-03-2009
    Location
    At that one place
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: IF formulas: possible to use variables?

    Alrighty, when I get home I'll hop on and attach a rough idea of what I'm going for.
    Last edited by Tsuchigo; 03-09-2011 at 04:31 PM.

  6. #6
    Registered User
    Join Date
    08-03-2009
    Location
    At that one place
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: IF formulas: possible to use variables?

    I was able to figure out how to do what I wanted using IF condition in a formula - I'll attach the file in case peoples were interested what I was trying to convey.

    Specifically Row H contains the formula I was trying to figure out. Thanks much for the input!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1