Quantcast

I need a visual basic string for MS excel

kidwoo

Artisanal Tweet Curator
posted here for more eyes

I'm creating an order sheet with the total cell right above where I want the next line.

The next line needs to figure out a percentage based on the line above it. If the total is less than x, 0%, if greater than y, 3%, if greater than z, 6%.

The third line multiplies the output of the second line by the percentage and subtracts it from the total, the first line.

I used to know how to do this stuff but I'm at a loss these days.

Thanks
 

Secret Squirrel

There is no Justice!
Dec 21, 2004
8,150
1
Up sh*t creek, without a paddle
Ok....It's very important to follow these steps exactly:

1. Purchase one (1) tube of Astroglide
2. Find furry woodland creature
3. Coat your keyboard with the purchased Astroglide
4. Try and stuff lubed keyboard into furry woodland creatures' rectum


You will have more success in this endeavor than trying to make anything useful come out of Excel.
 

binary visions

The voice of reason
Jun 13, 2002
22,162
1,261
NC
Let me understand here. You have:

Row A: some kind of total
Row B: you want to know, based on how big that total in Row A is, what percentage to output (either 0, 3 or 6)
Row C: You want to subtract the percentage in Row B from Row A (e.g. take 6% away from your total)
 

binary visions

The voice of reason
Jun 13, 2002
22,162
1,261
NC
Okay, so here's an example that would go in A2 underneath a total in A1:

=IF(A1<5000,0%,IF(A1>=5000,IF(A1<10000,3%,6%)))

That says that if the cell in A1 is less than 5k, it's 0, if it's greater than or equal to 5k but less than 10000, it's 3, otherwise it's 6. You have to have the cell formatted as a percentage.

Then, in A3, you'd have:

=A1-A1*A2

...since, by order of operations, it's subtracting (A1*A2) from A1.