Difference between column then show difference

PuntingJawa

Board Regular
Joined
Feb 25, 2021
Messages
157
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a sheet for packing slips quantity vs physical count quantity. Column F5 down for what the paperwork says we should receive. Column G5 down for the physical count. Both columns grow with each item received.
Is there a single formula that can show + or - the difference for F5 down vs G5 down and show nothing if equal?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This is what you need?

varios 16jul2024.xlsm
FGH
512-
621+
711 
822 
Hoja2
Cell Formulas
RangeFormula
H5:H8H5=IF(F5<G5,"-",IF(F5>G5,"+",""))


Or this:
varios 16jul2024.xlsm
FGH
512+
621-
711 
822 
Hoja2
Cell Formulas
RangeFormula
H5:H8H5=IF(F5<G5,"+",IF(F5>G5,"-",""))
 
Upvote 0
It would help if you give an example of what you have and what you expect from the result.
Try:

varios 16jul2024.xlsm
FGH
512-1
6211
711 
822 
Hoja2
Cell Formulas
RangeFormula
H5:H8H5=IF(F5=G5,"",F5-G5)


🧙‍♂️
 
Upvote 0
Fair enough. What I am trying to do is show any that are over/under the quantity received.
Column F is what the packing slip says.
Column G is what the physical count is.
I think I may place the formula in column M or N to show the quantity over/under.

The issue I am running into is I am hoping for one formula that will cover the columns as they increase downward with each input. I have a Userform that I utilize for the input of information and if the formula goes further than the last inputted line, the userform is going to try and place that information at the very end.


L-8.5-1 Shipping receiving log Userform - Copy.xlsm
ABCDEFGHIJ
4DateSupplierProjectDescriptionPart NumberOn PS if ≠ than receivedReceivedRejectedComments152-2
57/16/2024ULINESHOPPACKING TABLEH-9005-WOOD31PO 0001
67/16/2024ULINESHOPINSPECTION TAGS-928PS41PO 0001
77/16/2024ULINESHOPMASTERWRAPS-74120024PO 0001
87/16/2024ULINESHOPPOLYTUBES-112351PO 0001
Semec Corp Receiving
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F5:G1048576Expression=$F5<>$G5textNO
 
Upvote 0
I have a Userform that I utilize for the input of information and if the formula goes further than the last inputted line, the userform is going to try and place that information at the very end.

In that same userform, when entering the line with data, you can add the formula or the result of the calculation to that line.

For example:

Rich (BB code):
  'After putting the data on the sheet, put the following line (adapt "lastrow" with the name of your variable)
  Range("M" & lastrow).Value = Range("F" & lastrow).Value - Range("G" & lastrow).Value
 
Upvote 1
It may be easier to give you my userform. I utilized "erow" for this. I am unsure how to proceed.

VBA Code:
Private Sub RecDate_Change() 'Date

End Sub

Private Sub RecNCR_Change()
    RecNCR.Text = UCase(RecNCR.Text) 'NCR #
End Sub

Private Sub RecRMA_Change()
    RecRMA.Text = UCase(RecRMA.Text) 'RMA #
End Sub

Private Sub RecSupplier_Change()
    RecSupplier.Text = UCase(RecSupplier.Text) 'Supplier
End Sub

Private Sub RecProject_Change()
    RecProject.Text = UCase(RecProject.Text) 'Project #
End Sub

Private Sub RecDescription_Change()
    RecDescription.Text = UCase(RecDescription.Text) 'Item Description
End Sub

Private Sub RecPartNumber_Change()
    RecPartNumber.Text = UCase(RecPartNumber.Text) 'Part #
End Sub

Private Sub RecSlipQTY_Change()
    RecSlipQTY.Text = UCase(RecSlipQTY.Text) 'QTY on packing slip
End Sub

Private Sub RecCountQTY_Change()
    RecCountQTY.Text = UCase(RecCountQTY.Text) 'Actual QTY count
End Sub

Private Sub RecPackNumber_Change()
    RecPackNumber.Text = UCase(RecPackNumber.Text) 'Packing Slip #
End Sub

Private Sub RecPO_Change()
    RecPO.Text = UCase(RecPO.Text) 'PO #
End Sub

Private Sub UserForm_Activate()

RecDate.Text = Format(Now(), "MM/DD/YY") 'Auto date for today


End Sub
Private Sub ReceivingSubmit_Click() 'Command button submit

erow = Sheets("Receiving").Range("a" & Rows.Count).End(xlUp).Row 'Submit on next open "A" row
    Range("A" & erow + 1) = RecDate.Value 'Date
    Range("B" & erow + 1) = RecSupplier.Value 'Supplier
    Range("C" & erow + 1) = RecProject.Value 'Project #
    Range("D" & erow + 1) = RecDescription.Value 'Decription
    Range("E" & erow + 1) = RecPartNumber.Value 'Part #
    Range("F" & erow + 1) = RecSlipQTY.Value 'Packing slip QTY
    Range("G" & erow + 1) = RecCountQTY.Value 'Actual count QTY
    Range("I" & erow + 1) = "PS " & RecPackNumber.Value 'Pack Slip #
    Range("J" & erow + 1) = "PO " & RecPO.Value 'Purchase Order #
    Range("K" & erow + 1) = RecNCR.Value 'NCR #
    Range("L" & erow + 1) = RecRMA.Value 'RMA #
    'Calculation range should go here?
    ThisWorkbook.Save

End Sub

Private Sub ReceivingClear_Click()
    RecSupplier.Value = "" 'Supplier
    RecProject.Value = "" 'Project #
    RecDescription.Value = "" 'Decription
    RecPartNumber.Value = "" 'Part #
    RecSlipQTY.Value = "" 'Packing slip QTY
    RecCountQTY.Value = "" 'Actual count QTY
    RecPackNumber.Value = "" 'Pack Slip #
    RecPO.Value = "" 'Purchase Order #
    RecNCR.Value = "" 'NCR #
    RecRMA.Value = "" 'RMA #

End Sub
 
Upvote 0
Actually, I simplified it.

Excel Formula:
   Range("N" & erow + 1) = RecSlipQTY.Value - RecCountQTY.Value

I am utilizing existing formats already in the userform. Thank you for the help in leading me to an answer!
 
Upvote 1
Try, Try the following, this way you only add 1 in the erow variable


Rich (BB code):
Private Sub ReceivingSubmit_Click() 'Command button submit
  Dim erow As Long
  erow = Sheets("Semec Corp Receiving").Range("a" & Rows.Count).End(xlUp).Row + 1 'Submit on next open "A" row

    Range("A" & erow) = RecDate.Value 'Date
    Range("B" & erow) = RecSupplier.Value 'Supplier
    Range("C" & erow) = RecProject.Value 'Project #
    Range("D" & erow) = RecDescription.Value 'Decription
    Range("E" & erow) = RecPartNumber.Value 'Part #
    Range("F" & erow) = RecSlipQTY.Value 'Packing slip QTY
    Range("G" & erow) = RecCountQTY.Value 'Actual count QTY
    Range("I" & erow) = "PS " & RecPackNumber.Value 'Pack Slip #
    Range("J" & erow) = "PO " & RecPO.Value 'Purchase Order #
    Range("K" & erow) = RecNCR.Value 'NCR #
    Range("L" & erow) = RecRMA.Value 'RMA #

    'Calculation
    Range("M" & erow).Value = Range("F" & erow).Value - Range("G" & erow).Value

  'or 

    Range("N" & erow) = RecSlipQTY.Value - RecCountQTY.Value
    
    ThisWorkbook.Save
End Sub
 
Upvote 1
Solution

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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