Cashier Spreadsheet Project: Problem #1 - Simplifying a Formula

ackalbo

New Member
Joined
Mar 10, 2013
Messages
46
Hello everyone :)

I have recently acquired a small bar and decided that the Cashier Spreadsheet needed a rather major overhaul (business is too small to justify a POS system). I'm finding that the more time I spend on this, the more I think about the information that I would like to extract and how to go about this, therefore this has become somewhat of a project for me now which I find very interesting (from a delving deep into Excel perspective).

A little background info - The business hours are 3pm-2am. Drinks are cheaper 3pm-6pm (Happy Hour or "HH") after which, drinks revert to regular pricing until closing. Drinks are allowed to be purchased for staff members at an increased price. So, the cost of the drink depends on three factors:

  • Time of Purchase
  • Recipient of Purchase
  • Type of Drink Purchased


Visually, the spreadsheet looks like this:

Excel 2010
ABCDEFG
2TimeOrder NoCategoryItemUnit PriceQtyTotal Unit Cost
3
416:150001Customer DrinkSML75175
516:150001LDSML DLD2501250
620:320002Customer DrinkSML95195
720:320002LDSML DLD3001300

<tbody>
</tbody>
Data Entry

Field Explanation:

Column A - Formatted as 24hr and manually entered.
Column B - Receipt No and manually entered.
Column C - Cell drop down list (Data list on separate worksheet 'Background Data')
Column D - Cell drop down list (Data list on separate worksheet 'Background Data')
Column E - Contains the formula in question (Posted below). This formula determines the time, Category and type of drink in order to determine the Unit Price.
Column F - Manually entered.
Column G - Simple formula to calculate the Total Unit Cost.

Below is the spreadsheet with the formulas shown:

Excel 2010
ABCDEFG
2TimeOrder NoCategoryItemUnit PriceQtyTotal Unit Cost
3
416:150001Customer DrinkSML75175

<tbody>
</tbody>
Data Entry

Worksheet Formulas
CellFormula
E4=IF(D4="","",IF(AND(A4>0.583333,A4<0.75,'Data Entry'!C4="Customer Drink"),VLOOKUP(D4,'Price List'!$A$3:$E$123,3,FALSE),IF(AND(A4>=0.75,A4<0.999999,C4="Customer Drink"),VLOOKUP(D4,'Price List'!$A$3:$E$123,2,FALSE),IF(AND(A4>=0,A4<0.25,C4="Customer Drink"),VLOOKUP(D4,'Price List'!$A$3:$E$123,2,FALSE),IF(AND(A4>0.583333,A4<0.75,'Data Entry'!C4="LD"),VLOOKUP(D4,'Price List'!$A$3:$E$123,5,FALSE),IF(AND(A4>=0.75,A4<0.999999,C4="LD"),VLOOKUP(D4,'Price List'!$A$3:$E$123,4,FALSE),IF(AND(A4>=0,A4<0.25,C4="LD"),VLOOKUP(D4,'Price List'!$A$3:$E$123,4,FALSE),IF(C4="Party Animal",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="RTB",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="Tossed Balls",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="Shirt",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="Beer Wrap",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="Towel",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),IF(C4="Key Chain",VLOOKUP(C4,'Price List'!$A$3:$E$123,2,FALSE),""))))))))))))))
G4=IF(E4="", "", F4*E4)

<tbody>
</tbody>

<tbody>
</tbody>



A sample of the 'Price List' worksheet which is referenced within the VLOOKUP functions:

Excel 2010
ABCDE
1Cust RegCust HHLD RegLD HH
2
3Other - Not Listed
4Absolut Vodka 160 135 215 195
5Absolut Citron 160 135 215 195
6Absolut Mandarin 160 135 215 195
7Absolut Raspberri 160 135 215 195
8Amaretto 95 75 150 135
9Antonov Ice 95 75 150 135

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Price List




One will notice that there are other items referenced in the formula within 'Data Entry'C4 such as "Party Animal" and "Shirt", these are items that are sold for a singular price regardless of whether they are for a customer or staff - These non dependant items are causing their own problem i.e. If "Shirt" is selected from the drop down list in cell C4 for some reason the price will not be looked up unless something from the drop down list in cell D4 is selected (which should not be required).

So, guys and gals, any suggestions on simplifying the well nested IF formula in cell E4?

Any assistance will be greatly appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi ackalbo,

I'd suggest you try to organize your data so that you can use a relatively simple INDEX-MATCH formula to lookup the price on your Price List.

Ultimately it would take the form of...
=INDEX(PriceData,MATCH(D3,INDEX(PriceData,0,1),0),ColumnIndex)

Where:
PriceData is your Price List Lookup Range
MATCH(D3,INDEX(PriceData,0,1),0) evaluates to the Row that the item found in the Price List
ColumnIndex is the Column to be read on the Price List

The tricky part is translating the 3 factors into a ColumnIndex.
It would simplify things if you added another column "Fixed Price" to the price table for items like "Party Animal" and "Shirt"; and added "Fixed Price" to the drop down lists in Category.

This would allow us to derive ColumnIndex based on just the two factors Time and Category.

If that sounds like an approach you would like to pursue, I'll suggest some options.
One thing that isn't clear to me is what price is used when the time doesn't fall into one of the two ranges in the existing formula
A4>0.583333,A4<0.75
A4>=0.75,A4<0.999999
I presume there isn't a third rate based on time < =0.583333.
If you'll confirm that, then the formula will just need to consider that anything outside of the Happy Hour range is Regular rate.

EDIT: I just noticed the part of the existing formula addresses Midnight to 2:00 AM. I'd still suggest simplifying that to Happy Hour and everything else.
 
Last edited:
Upvote 0
Hi JS411. Thank you for the reply and asstance :)

I haven't used the INDEX - MATCH formulas before although I've come across them in the past. I shall research them now, see how to use them and get back to you here.

EDIT: I just noticed the part of the existing formula addresses Midnight to 2:00 AM. I'd still suggest simplifying that to Happy Hour and everything else.

I agree, originally the formula was set up to determine whether or not a sale was between 2pm - 6pm and 6pm - 3am but with the 2nd time frame I encountered problems with crossing over midnight.

Be back soon, off to Google INDEX & MATCH....
 
Upvote 0
It would simplify things if you added another column "Fixed Price" to the price table for items like "Party Animal" and "Shirt"; and added "Fixed Price" to the drop down lists in Category.

I was just wondering, would it make things easier or harder if "Merchandise" was added to the Category drop down list and then the separate merchandise items listed at the end of the Items drop down list?

At present the "Fixed Price" merchandise items are listed at the bottom of the Items PriceList but actually appear within the Category drop down list:

Excel 2010
ABCDE
1Cust RegCust HHLD RegLD HH
2
110Tia Maria160 135 215 195
111Tomato Juice85 65 140 125
112VO160 135 215 195
113Vodka (Local)95 75 150 135
114Wild Turkey160 135 215 195
115Wine, Red105 95 160 155
116Wine, White105 95 160 155
117Party Animal2000
118RTB3500
119Tossed Balls400
120Shirt350
121Beer Wrap150
122Towel150
123Key Chain100

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Price List
 
Upvote 0
Hi JS411 :)

After playing around with INDEX - MATCH for awhile I now understand (I hope) that:

MATCH - Provides the position of an element within an array.
INDEX - Provides an element based on position.

Providing my understanding of this is correct then I have been "stripping down" the formula that you have kindly suggested and there is a part that I find confusing.

The formula is as follows:

=INDEX(PriceData,MATCH(D3,INDEX(PriceData,0,1),0),ColumnIndex)

which I have adapted (as a test) to:

=INDEX('Price List'!A4:F116,MATCH(D20,INDEX('Price List'!A4:F116,0,1),0),3)

The bold type is the area causing me some confusion, if I am reading this right then the formula is looking at Row 0, Column 1 within the range 'Price List'!A4:F116 but there isn't a Row 0 :confused: and when the formula is used on it's own "=INDEX('Price List'!A4:F116,0,1)" then #VALUE is the result yet the entire formula as a whole, works yet it my mind the MATCH function ends up being MATCH(D20,#VALUE,0)........

What (if anything) am I missing here?
 
Upvote 0
Looks like you're making great progress! :)

Using INDEX with a 0 value for the Rows argument returns all Rows.
INDEX('Price List'!A4:F116,0,1) should return a reference to range 'Price List'!A4:A116

The same result could be accomplished for your current layout with
=INDEX('Price List'!A:F,MATCH(D20,'Price List'!A:A,0),3)
...however by using a named range and Indexing the first column, it allows you to change the location of your lookup table without needing to modify all the formulas.
 
Upvote 0
A big thank you to JS411 for pointing me in the right direction with this :biggrin:

Finally finished.......except for one tiny little problem......I foresee a "Cashier Spreadsheet Project: Problem #2" coming up...
 
Upvote 0
Glad to hear that you worked through a solution. You're welcome to add that Problem #2 to this thread, or start another.
 
Upvote 0

Forum statistics

Threads
1,215,700
Messages
6,126,285
Members
449,308
Latest member
VerifiedBleachersAttendee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top