Need help with random numbers

hi i need to generate 2 random numbers from array list . and then take out that two numbers from list.
     String[] plcard = { "AC", "KC", "QC", "JC",
          "10C", "9C", "8C", "7C","6C","5C","4C","3C","2C", "AD", "KD", "QD", "JD",
          "10D", "9D", "8D", "7D","6D","5D","4D","3D","2D", "AS", "KS", "QS", "JS",
          "10S", "9S", "8S", "7S","6S","5S","4S","3S","2S", "AH", "KH", "QH", "JH",
          "10H", "9H", "8H", "7H","6H","5H","4H","3H","2H",};
this is the list if someone can help me i would appreciate
thanks in advance

haha, never noticed the .shuffle(List) method!
maybe java is getting too convenient (just kidding)?
i never wrote a card game.
how would the more programmingly gifted of us do this?
this is my shot at it for what its worth...
public class Card{
public Card(int rank, int suit){
this.rank = rank;
this.suit = suit;
int rank (or String i suppose)
int suit;
static final club = 1;
static final spade = 2;
static final heart = 3;
static final diamond = 4;
public class Shuffler{
public Shuffler(){
int NumOfDecks = 1;
Vector ShuffledDeck;
// num of decks
for(int i = 0; i < NumOfDecks){
// 4 suits
for(int j = 0; j < 4; j++){
// 13 ranks
for(int k = 0; k < 13; k++){
ShuffledDeck.add(new Card(k, j));
} // suits
} // num of decks
Collections.shuffle(ShuffledDeck);
// Done?
}

Similar Messages

  • Need Help with random numbers, please help

    Hi guys;
    I need your help for a school project. I need to generate a random number from 1.0 to 2.0. How would I do that?
    Regards,

    http://java.sun.com/j2se/1.3/docs/api/java/util/Random.html#nextFloat()

  • I need help with random number in GUI

    hello
    i have home work about the random number with gui. and i hope that you can help me doin this application. and thank you very much
    Q1)
    Write an application that generates random numbers. The application consists of one JFrame,
    with two text fields (see the figures) and a button. When the user clicks on the button, the
    program should generate a random number between the minimum and the maximum numbers
    entered in the text fields. The font of the number should be in red, size 100, bold and italic.
    Moreover, if the user clicks on the generated number (or around it), the color of the background
    should be changed to another random color. The possible colors are red, green blue , black ,cyan
    and gray.
    Notes:
    �&#61472;The JFrame size is 40 by 200
    �&#61472;The text fields size is 10
    this is a sample how should the programe look like.
    http://img235.imageshack.us/img235/9680/outputgo3.jpg
    Message was edited by:
    jave_cool

    see java.util.Random

  • Need some help with Random numbers.

    Hey,
    Im not sure why this is not working....
        public static void main(String[] args) {
        System.out.printf ("Enter n:\n");
        Scanner keyboard = new Scanner (System.in);
            int n1=0,
            n2=0,
            n3=0,
            n4=0,
            n5=0,
            n6=0,
            facevalue,
            x1,
            count = 0;
            double x = keyboard.nextDouble ();
            x1 = rollDie ();
            System.out.println(x1);
        while (count < x) {
            facevalue = 1+x1.nextInt (6);
            if (facevalue == 1) n1++;
            if (facevalue == 2) n2++;
            if (facevalue == 3) n3++;
            if (facevalue == 4) n4++;
            if (facevalue == 5) n5++;
            if (facevalue == 6) n6++;
            count += 1 ; }
        System.out.printf ("%d %d %d %d %d %d\n",n1,n2,n3,n4,n5,n6);
            int maxValue = n1;
            if (maxValue < n2)
                maxValue = n2;
            if (maxValue < n3)
                maxValue = n3;
            if (maxValue < n4)
                maxValue = n4;
            if (maxValue < n5)
                maxValue = n5;
            if (maxValue < n6)
                maxValue = n6;
        System.out.printf ("Max %d\n",maxValue);
        System.out.printf ("Avg %f\n",
        1/x*(n1*1+n2*2+n3*3+n4*4+n5*5+n6*6));
        public static int rollDie (){
            int x1 = (int) Math.random();
            System.out.println(x1);
            return x1;
    }The random number is always 0. Also there is an error at facevalue = 1+x1.nextInt (6); That says 'int cannot be dereferenced.' Please help! thanks!

    Also, this particular assignment seems to be a good time for you to learn about arrays. Look for a tutorial on java arrays. This will reduce your lines of code by 75%.
    What I mean is, you have 6 different variables to hold the total number of times each roll occurred. Instead, you could have a length-6 array:
      //declaring
      int[] tally = new int[6];
      //adding one to the tally
      int nextRoll = random.nextInt(6) + 1;
      tally[nextRoll-1]++;

  • Newbie needing help with code numbers and if-else

    I'm 100% new to any kind of programming and in my 4th week of an Intro to Java class. It's also an on-line class so my helpful resources are quite limited. I have spent close to 10 hours on my class project working out P-code and the java code itself, but I'm having some difficulty because the project seems to be much more advanced that the examples in the book that appear to only be partly directly related to this assignment. I have finally come to a point where I am unable to fix the mistakes that still show up. I'm not trying to get anyone to do my assignment for me, I'm only trying to get some help on what I'm missing. I want to learn, not cheat.
    Okay, I have an assignment that, in a nutshell, is a cash register. JOptionPane prompts the user to enter a product code that represents a product with a specific price. Another box asks for the quanity then displays the cost, tax and then the total amount plus tax, formatted in dollars and cents. It then repeats until a sentinel of "999" is entered, and then another box displays the total items sold for the day, amount of merchandise sold, tax charged, and the total amount acquired for the day. If a non-valid code is entered, I should prompt the user to try again.
    I have this down to 6 errors, with one of the errors being the same error 5 times. Here are the errors:
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:50: 'else' without 'if'
    else //if invalid code entered, output message
    ^
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:39: unexpected type
    required: variable
    found : value
    100 = 2.98;
    ^
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:41: unexpected type
    required: variable
    found : value
    200 = 4.50;
    ^
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:43: unexpected type
    required: variable
    found : value
    300 = 6.79;
    ^
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:45: unexpected type
    required: variable
    found : value
    400 = 5.29;
    ^
    C:\PROGRA~1\XINOXS~1\JCREAT~1\MyProjects\Sales.java:47: unexpected type
    required: variable
    found : value
    500 = 7.20;
    ^
    And finally, here is my code. Please be gentle with the criticism. I've really put a lot into it and would appreciate any help. Thanks in advance.
    import java.text.NumberFormat; // class for numeric formating from page 178
    import javax.swing.JOptionPane; // class for JOptionOPane
    public class Sales {
    //main method begins execution ofJava Application
    public static void main( String args[] )
    double quantity; // total of items purchased
    double tax; // total of tax
    double value; // total cost of all items before tax
    double total; // total of items including tax
    double totValue; // daily value counter
    double totTax; // daily tax counter
    double totTotal; // daily total amount collected (+tax) counter
    double item; //
    String input; // user-entered value
    String output; // output string
    String itemString; // item code entered by user
    String quantityString; // quantity entered by user
    // initialization phase
    quantity = 0; // initialize counter for items purchased
    // get first code from user
    itemString = JOptionPane.showInputDialog(
    "Enter item code:" );
    // convert itemString to double
    item = Double.parseDouble ( itemString );
    // loop until sentinel value read from user
    while ( item != 999 ) {
    // converting code to amount using if statements
    if ( item == 100 )
    100 = 2.98;
    if ( item == 200 )
    200 = 4.50;
    if ( item == 300 )
    300 = 6.79;
    if ( item == 400 )
    400 = 5.29;
    if ( item == 500 )
    500 = 7.20;
    else //if invalid code entered, output message
    JOptionPane.showMessageDialog( null, "Invalid code entered, please try again!",
    "Item Code", JOptionPane.INFORMATION_MESSAGE );
    } // end if
    } // end while
    // get quantity of item user
    itemString = JOptionPane.showInputDialog(
    "Enter quantity:" );
    // convert quantityString to int
    quantity = Double.parseDouble ( quantityString );
    // add quantity to quantity
    quantity = quantity + quantity;
    // calculation time! value
    value = quantity * item;
    // calc tax
    tax = value * .07;
    // calc total
    total = tax + value;
    //add totals to counter
    totValue = totValue + value;
    totTax = totTax + tax;
    totTotal = totTotal + total;
    // display the results of purchase
    JOptionPane.showMessageDialog( null, "Amount: " + value +
    "\nTax: " + tax + "\nTotal: " + total, "Sale", JOptionPane.INFORMATION_MESSAGE );
    // get next code from user
    itemString = JOptionPane.showInputDialog(
    "Enter item code:" );
    // If sentinel value reached
    if ( item == 999 ) {
    // display the daily totals
    JOptionPane.showMessageDialog( null, "Total amount of items sold today: " + quantity +
    "\nValue of ites sold today: " + totValue + "\nTotal tax collected today: " + totTax +
    "\nTotal Amount collected today: " + totTotal, "Totals", JOptionPane.INFORMATION_MESSAGE );
    System.exit( 0 ); // terminate application
    } // end sentinel
    } // end message
    } // end class Sales

    Here you go. I haven't tested this but it does compile. I've put in a 'few helpful hints'.
    import java.text.NumberFormat; // class for numeric formating from page 178
    import javax.swing.JOptionPane; // class for JOptionOPane
    public class TestTextFind {
    //main method begins execution ofJava Application
    public static void main( String args[] )
         double quantity; // total of items purchased
         double tax; // total of tax
         double value; // total cost of all items before tax
         double total; // total of items including tax
    //     double totValue; // daily value counter
    //     double totTax; // daily tax counter
    //     double totTotal; // daily total amount collected (+tax) counter
    // Always initialise your numbers unless you have a good reason not too
         double totValue = 0; // daily value counter
         double totTax = 0; // daily tax counter
         double totTotal = 0; // daily total amount collected (+tax) counter
         double itemCode;
         double item = 0;
         String itemCodeString; // item code entered by user
         String quantityString; // quantity entered by user
         // initialization phase
         quantity = 0; // initialize counter for items purchased
         // get first code from user
         itemCodeString = JOptionPane.showInputDialog("Enter item code:" );
         // convert itemString to double
         itemCode = Double.parseDouble ( itemCodeString );
         // loop until sentinel value read from user
         while ( itemCode != 999 ) {
    * 1. variable item mightnot have been initialised
    * You had item and itemCode the wrong way round.
    * You are supposed to be checking itemCode but setting the value
    * for item
              // converting code to amount using if statements
              if ( item == 100 )
              {itemCode = 2.98;}
              else if ( item == 200 )
              {itemCode = 4.50;}
              else if ( item == 300 )
              {itemCode = 6.79;}
              else if ( item == 400 )
              {itemCode = 5.29;}
              else if ( item == 500 )
              {itemCode = 7.20;}
              else {//if invalid code entered, output message
                   JOptionPane.showMessageDialog( null, "Invalid code entered, please try again!",
                   "Item Code", JOptionPane.INFORMATION_MESSAGE );
              } // end if
         } // end while
         // get quantity of item user
         itemCodeString = JOptionPane.showInputDialog("Enter quantity:" );
    * 2.
    * You have declared quantityString here but you never give it a value.
    * I think this should be itemCodeString shouldnt it???
    * Or should you change itemCodeString above to quantityString?
         // convert quantityString to int
    //     quantity = Double.parseDouble ( quantityString );  // old code
         quantity = Double.parseDouble ( itemCodeString );
         // add quantity to quantity
         quantity = quantity + quantity;
         // calculation time! value
         value = quantity * itemCode;
         // calc tax
         tax = value * .07;
         // calc total
         total = tax + value;
         //add totals to counter
    * 3. 4. and 5.
    * With the following you have not assigned the 'total' variables a value
    * so in effect you are saying eg. "total = null + 10". Thats why an error is
    * raised.  If you look at your declaration i have assigned them an initial
    * value of 0.
         totValue = totValue + value;
         totTax = totTax + tax;
         totTotal = totTotal + total;
         // display the results of purchase
         JOptionPane.showMessageDialog( null, "Amount: " + value +
         "\nTax: " + tax + "\nTotal: " + total, "Sale", JOptionPane.INFORMATION_MESSAGE );
         // get next code from user
         itemCodeString = JOptionPane.showInputDialog("Enter item code:" );
         // If sentinel value reached
         if ( itemCode == 999 ) {
              // display the daily totals
              JOptionPane.showMessageDialog( null, "Total amount of items sold today: " + quantity +
              "\nValue of ites sold today: " + totValue + "\nTotal tax collected today: " + totTax +
              "\nTotal Amount collected today: " + totTotal, "Totals",           JOptionPane.INFORMATION_MESSAGE );
              System.exit( 0 ); // terminate application
         } // end sentinel
    } // end message
    } // end class SalesRob.

  • Need help with skype numbers....urgent please!

    Question regarding skype numbers..... So i plan to buy hongkong skype number,......say for example + 852 8192 6362, and if im right , i can receive the calls on my PC /desktop, etc. But what about if im traveling , for few days to mainland china or london , will my family still be able to call the same number with appropriate county code, n will i continue to recive calls on my PC. { *Example calling me in china +8621 8192 6362 } In short, can my family call my anywhere in the world by using proper country codes, or is skype number limited to hongkong only, I travel alot, and cant change numbers frequently. Thanks....

    Hi, ajamal786, and welcome to the Community,
    Yes, your one Skype Number travels with your account regardless of wherever you are.  Such is the beauty of a Skype Number: people can call you on the number you set up, which in theory would be a local call to them depending upon the availability of numbers from which you can choose (my Skype Number exchange is a few townships away, but still a local call), and reach you on Skype.
    So, no need to change a Skype Number.
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Need Help with Random Events in Actionscript 2

    I'm working on a game in flash right now, written in actionscript 2, where bottles fall from above at random speeds, and the object is to shoot the bottles as they fall, and every time you hit a bottle a different message appears on the screen for a brief period of time before disappearing.  So far I'm able to make the bottles fall and I'm able to shoot and break them, but I don't know how to work it so a different message appears each time you shoot a bottle. 
    Can anyone help me with this problem?  I'm attaching the file of what I have so far.

    My first question would be, when you say "different message appears" each time you hit a bottle.
    What are the messages and do you want them to be random, and where will they appear.
    After looking at your code, the best place I can see to place your message trigger is within the hit test. From there its a somple case of calling a function to display your message.

  • I need help with the numbering pages in a book file

    I have a 53 chapter book that which each chapter is its own document. It used to work great. The page numbers of each document used to continue from the last page number of the previous document. That was until today when I opened it and all the page numbers now start at one. I don't know what to do. I have checked all of the options I knew to check. Each document still has the 'automatic page numbering' option selected. I truly don't want to have to go through and manully renumber every document. It will take time I do not have. If I can get somebody's help, it would be wonderful.

    Nor do I. It sounds like everything is set correctly. You might want to try creating a new Book file and add the individaul documents into it and see if that fixes things. Also, have you tried updating the numberingfrom the menu since this started?

  • Need help with formating numbers

    public void returnDollars()
              double dollar;
              dollar=amountr-amount;
    NumberFormat fmt = NumberFormat.getNumberInstance();
              System.out.println(fmt.fomat(dollar));
    there is my code.....now lets say
    amountr = 10
    amount 8.5
    now when i print my dollar amount i want it to show up as 1 not 1.5 or 2. So in other words format it with no decimals and not round up at the same time.
    Help would be appriciated...thanks

    well...after 8 hours of trying to get it working i did it.....here it is ...........I'm sure there are many ways to make it smaller.
    import java.text.*;
    import java.io.*;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    public class Cashier
    double amount;
    double amountr;
    double dollar;
    double amountleft;
    double quaters;
    double test;
    double dimes;
    double pennies;
    public void getAmount()throws IOException
         BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
              System.out.println("Please enter amount due:");
              String input = console.readLine();
         amount = Double.parseDouble(input);
    System.out.println("Amount due = " + amount);
         public void recieve()throws IOException
    BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
              System.out.println("Please enter amount recieved :");
              String input = console.readLine();
         amountr = Double.parseDouble(input);
    System.out.println("Amount recieved = " + amountr);
         public void returnDollars()throws IOException
              double check = amountr-amount;
              dollar=amountr-amount;
    DecimalFormat fmt = new DecimalFormat("##");
    String s = fmt.format((double)(long)dollar);
    double d = Double.valueOf(s).doubleValue();
    amountleft=check-d;
         System.out.println("Dollars to return " + s);
    public void returnQuaters()
         quaters= amountleft/.25;
         double check = quaters;
    DecimalFormat fmt = new DecimalFormat("##");
    String s = fmt.format((double)(long)quaters);
    double d = Double.valueOf(s).doubleValue();
    fmt.setMaximumFractionDigits(2);
    String dol = fmt.format(amountleft);
              //System.out.println(dol);
              double e =Double.valueOf(dol).doubleValue();
    e= e-2*(.25);
    amountleft=e;
         System.out.println("Quaters to return: " + s);
         public void returnDimes()
         dimes= amountleft/.1;
         double check = dimes;
    DecimalFormat fmt = new DecimalFormat("##");
    String s = fmt.format((double)(long)dimes);
    System.out.println("Dimes to return: " + s);
    double d = Double.valueOf(s).doubleValue();
    fmt.setMaximumFractionDigits(2);
    String dol = fmt.format(amountleft);
              double e =Double.valueOf(dol).doubleValue();
    e= e-1*(.1);
    fmt.setMaximumFractionDigits(2);
    String dola = fmt.format(e);
              double t =Double.valueOf(dola).doubleValue();
    amountleft=t;
              public void returnNickles()
         double nickles = amountleft/.05;
              double check = nickles;
    DecimalFormat fmt = new DecimalFormat("##");
    String s = fmt.format((double)(long)nickles);
    System.out.println("Niclkles to return: " + s);
    double d = Double.valueOf(s).doubleValue();
    fmt.setMaximumFractionDigits(2);
    String dol = fmt.format(amountleft);
              double e =Double.valueOf(dol).doubleValue();
    e= e-1*(.05);
    fmt.setMaximumFractionDigits(2);
    String dola = fmt.format(e);
              double t =Double.valueOf(dola).doubleValue();
    amountleft=t;
         public void returnPennies()
              double pennies = amountleft/.01;
    DecimalFormat fmt = new DecimalFormat("##");
    String s = fmt.format((double)(long)pennies);
    System.out.println("Pennies to return: " + s);
         public static void main(String[] a) throws IOException
              Cashier cash = new Cashier();
              cash.getAmount();
              cash.recieve();
              cash.returnDollars();
              cash.returnQuaters();
              cash.returnDimes();
              cash.returnNickles();
              cash.returnPennies();

  • Need help with binary numbers

    hey i'm doing some things, but i need a entry of a binary coded number, i know that an hex number is written like 0xFF but how do i put a binary number in an instruction such as:
    byte b
    b="binary number"

    I see what you want to do, but you can only do this with octal and hex. With binary, you would have to do it something like this:
    byte b = Byte.parseByte("01101001", 2); // base-2

  • Need hep with random numbers

    Me and my friends play magic the gathering. There is a mode called planechase. I wont to build a program that simulates this. so it will randomize 82 numbers then store them in the order generated. the game also involves drawing the next card, revealig
    next card, and putting cards on bottom. Any help given will be greatly appreciated. I'm just trying to get an idea of where to start.

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right
    forum.
    In my opinion, you my consult on
    Visual Studio Language Forums: http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need help with rounding numbers in Java

    I finally have this program to where it needs to be except for one thing. The variable "freetime" isn't showing any kind of output in the applet. The variable sum and freetime are both called at the start of the program, and have equations to figure out the output for them, but only sum shows an output. I tried using brackets as opposed to multiple parentheses. What can I do to fix this so that there is an output? I was thinking of using something to round up the result, but I can't figure it out. Can anyone help?
    import java.awt.*;
    import javax.swing.*;
    public class FinalLab extends JApplet{
    String firstNum, secondNum, thirdNum, fourthNum, fifthNum;
    int personal, family, school, work, sleep, sum, freetime;
    public void init()
    String firstNum, secondNum, thirdNum, fourthNum, fifthNum;
    firstNum = JOptionPane.showInputDialog( "Enter total personal hours." );
    secondNum = JOptionPane.showInputDialog( "Enter total family hours." );
    thirdNum = JOptionPane.showInputDialog( "Enter total school hours." );
    fourthNum = JOptionPane.showInputDialog( "Enter total work hours." );
    fifthNum = JOptionPane.showInputDialog( "Enter total sleep hours." );
    personal = Integer.parseInt( firstNum );
    family = Integer.parseInt( secondNum );
    school = Integer.parseInt( thirdNum );
    work = Integer.parseInt( fourthNum );
    sleep = Integer.parseInt( fifthNum );
    sum = (personal + family + school + work + sleep);
    freetime = ((168-sum)/168)*100;
    public void paint(Graphics g) {
    super.paint( g );
    g.drawRect( 15, 10, 270, 20 );
    g.drawRect( 15, 35, 270, 20 );
    g.drawRect( 15, 60, 270, 20 );
    g.drawRect( 15, 85, 270, 20 );
    g.drawRect( 15, 110, 270, 20 );
    g.drawRect( 15, 135, 270, 20 );
    g.drawRect( 15, 160, 270, 20 );
    g.drawString( "Personal hours: " + personal, 25, 25);
    g.drawString( "Family hours: " + family, 25, 50);
    g.drawString( "School hours: " + school, 25, 75);
    g.drawString( "Work hours: " + work, 25, 100);
    g.drawString( "Sleep hours: " + sleep, 25, 125);
    g.drawString( "Total hours: " + sum, 25, 150);
    g.drawString( "Free time: " + freetime, 25, 175);
    }

    I am guessing that you really meant that you are seeing "Free time: 0" instead of what you said, which was that it wasn't showing any kind of output. (Your whole terminology is weird, you don't "call a variable" just for example.) If that's the case, it's because you are using integer division. You'll find that 27/168, for example, gives zero. I don't know why you are multiplying by 100 in your calculation and doing the division, perhaps you meant to return the free time as a percentage (in which case your output should say that), but since you are doing that you could do it this way:((168-sum)*100/168)Then you are doing 2700/168, which produces a reasonable number.

  • Need help with a Numbers (ISBLANK) formula

    Having trouble with a cell formula that tests 2 cells for blank condition.
    I want to sum 2 cells only if they are BOTH blank.  (Trying to eliminate the
    "0" in the sum cell if both test cells are blank.)
    I've tried using ISBLANK, AND, IF functions but no success.
    Would appreciate your help on this. Thank you.

    Hi there.
    Perhaps due to my bad english, I could not understand your question, but I want to help, anyway.
    The question is: why would you want to sum two blank cells? Or what you want is to sum two cells IF two different cells are blank?
    Best regards,
    Otávio

  • Need help with my numbers app synching with icloud

    My numbers app just stopped synching with icloud and my ipad2. And vice versa. I deleted then reinstalled the app, synched the phone, etc. and it still won't transfer to iclous. Any suggestions?

    Find your serial number quickly
    Sign in, activation, or connection errors | CS5.5 and later, Acrobat DC
    Mylenium

  • Need help with a numbers formula

    Hi I am looking for the formula in numbers to do the following apologies if I havn't explained this properly:
    if I x is greater than y subtract z
    eg
    if A2 is greater than 7 subtract 1..... so if A2 was 9 B2 would be 8 but if A2 was 6 B2 would be 6

    Hi tick,
    As I read your statement, x is the numer in column A, x is a constant placed either in the formula or in a separate cell (not A or B), and z is the result in column B.
    This example uses the constant 7, placed in a separate table:
    Formula in column B:
    =IF(A>Table 2::$A$2,A-1,A)
    Here, the constant is written into the formula:
    Formula in column B:
    =IF(A>7,A-1,A)
    Regards,
    Barry

Maybe you are looking for

  • Report painter question regarding amounts in different currencies

    Hi, I have a report created in GRR2 using library 1VK. We display the total costs SWOG here but have the request to see in addition these costs in USD simulteanously. For that I included the basic key figure SWZG. When executing the report there is n

  • Selection variable for next month in RFPERIOD_OPEN in closing cockpit

    Hi, we would like to use RFPERIOD_OPEN in the closing cockpit in order to open the next period on D-10 automatically. I would like to use the selection variables of the closing cockpit in the program variant in order to avoid unnecessary variant main

  • HT2292 How can I get my ipod classic to show up in devices in itunes?

    I need help.  My Ipod classic does not show up in devices.   I go to device manager and it does not show up. help

  • OCTROI DURING STOCK TRANSPORT ORDER

    Hi, We have the following scenario. Octroi has to be paid during goods transfer from one plant to other. I'll be having an octroi agent who'll be paying the octroi for on my behalf. and the actroi agent will get this amount reimbursed once in a month

  • Disk full.  Will not reboot

    While exporting a large number of pictures from iPhoto on an external drive to a folder on my desktop, my system froze. I think it ran out of disk space. I had to manually power off. When I rebooted, I got only a grey screen with a tiny finder window